I needed to find a file that was created in March 2009. The folder isn’t indexed so I created this PowerShell script to help find the files within a specified date range.
childitem -filter *.doc? -recurse |
where {$_.CreationTime -gt
[datetime]::parse("03/01/2009") -and
$_.CreationTime -lt
[datetime]::parse("03/31/2009") -and
$_.length -gt 50}
The first line recursively finds all files with a doc or docx extension.
childitem -filter *.doc? -recurse |
Lines 2-3 look for a file with a creation time greater than (-gt) March 1st 2009.
where {$_.CreationTime -gt
[datetime]::parse("03/01/2009") -and
Lines 4-5 look for a file with a creation time less than (-lt) March 31st 2009.
$_.CreationTime -lt
[datetime]::parse("03/31/2009") -and
And the final line looks for files larger that 50 bytes.
$_.length -gt 50}