size and last modified attribute powershell command

is there any way via a powershell cmdlet or similar to audit a directory, and it return for all sub directories and the level below, the total size of that sub directory and all files within, and the last modified attribute that you get in windows explorer, and write the results to xlsx or csv. we have a file share which contains users home drives, and many of which appear to be of former staff which can be removed, but having a comprehensive report would be great.
Who is Participating?
QlemoConnect With a Mentor Batchelor, Developer and EE Topic AdvisorCommented:
Though there are (a lot of) scripts out to collect size and date stats, it is usually much better to use tools like WinDirStat or TreesSize(Pro), because it allows interaction and recalculation (e.g. deleting a folder immediately corrects all stats for parent tree).
The modification time stamp of folders is not reliable, by the way.
pma111Author Commented:
>The modification time stamp of folders is not reliable, by the way.

is there anything else you can do then to analyze when that folder was last accessed/amended, bar that attribute?
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
The dates of the files contained in a folder are reliable.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.