I've found (on this site: http://powershell.com/cs/blogs/tobias/archive/2008/11/25/cleaning-hard-drives-and-finding-folders-total-size.aspx ) a great script
dir C:\ | Where-Object { $_.PSisContainer } |
ForEach-Object { Write-Progress 'Examining Folder' ($_.FullName); $_ } |
ForEach-Object { $result = '' | Select-Object Path, Count, Size;
$result.path = $_.FullName;
$temp = Dir $_.FullName -recurse -ea SilentlyContinue |
Measure-Object length -sum -ea SilentlyContinue ;
$result.count = $temp.Count; $result.Size = $temp.Sum; $result } |
Sort-Object Size -descending
to calculate a folder size, and there are two simple modifications I'm trying to figure out how to do -
1.) I want the script recursively go through all directories and
2.) Save the output to a .csv file.
I think I know how to do this with a VB script, but I'm not sure the syntax powershell is looking for?
Can someone help me?
Thank you!
Ed