cbergeron

Untitled

Oct 1st, 2026
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. $roots = 'E:\Road Patrol Case Files','E:\CID'
  2. foreach ($r in $roots) {
  3. "=== $r ==="
  4. # Per top-level folder
  5. Get-ChildItem $r -Directory | ForEach-Object {
  6. $s = (Get-ChildItem $_.FullName -Recurse -File -ErrorAction SilentlyContinue |
  7. Measure-Object Length -Sum).Sum
  8. '{0,-40} {1,10:N1} GB' -f $_.Name, ($s/1GB)
  9. }
  10. # Per file-year (growth forecast)
  11. Get-ChildItem $r -Recurse -File -ErrorAction SilentlyContinue |
  12. Group-Object { $_.LastWriteTime.Year } | Sort-Object Name | ForEach-Object {
  13. '{0} {1,10:N1} GB ({2:N0} files)' -f $_.Name,
  14. (($_.Group | Measure-Object Length -Sum).Sum/1GB), $_.Count
  15. }
  16. }
Add Comment
Please, Sign In to add comment