Hi All,
I have the code below to find files that are older than 6 moths and greater than 1 gb:
$pathname = Read-Host "Please Enter Path Name: "
$files = Get-ChildItem $pathname -Recurse -File |
Where-Object { $_.LastAccessTime -le (Get-date).AddMonths(-6) -and $_.Length -ge 1GB } |
Select FullName,CreationTime,LastAccessTime,LastWriteTime |
Export-Csv "c:\$(($pathname -split "\\")[-1]).csv" -NTI
Open in new window
I need to add to the spreadsheet the size of the files, how do I do this?