troubleshooting Question

size of file

Avatar of Kelly Garcia
Kelly GarciaFlag for United Kingdom of Great Britain and Northern Ireland asked on
PowershellScripting Languages
1 Comment1 Solution168 ViewsLast Modified:
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 

I need to add to the spreadsheet the size of the files, how do I do this?
ASKER CERTIFIED SOLUTION
Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros