Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $numberOfDays = ""
- $pathToArchive = ""
- $csvPath = ""
- Function Get-ArchivableFiles
- {
- Param([string[]]$path,
- [int]$numberDays)
- $cutOffDate = (Get-Date).AddDays(-$numberDays)
- Get-ChildItem -Path $path -recurse |
- Where-Object {$_.LastAccessTime -le $cutOffDate}
- }
- $results = Get-ArchivableFiles -path $pathToArchive -numberDays $numberOfDays | select name, fullname, length, lastaccesstime
- $results | Export-CSV $csvPath
- $results | measure -sum length | % {$_.sum / 1gb}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement