December 2015
Intermediate to advanced
760 pages
14h 31m
English
In this recipe, we will search for files based on filenames, attributes, and content.
Let's explore different ways to use Get-ChildItem to search for files:
#search for file with specific extension $path = "C:\Temp" Get-ChildItem -Path $path -Include *.sql -Recurse #search for file based on date creation #use LastWriteTime for date modification [datetime]$startDate = "2015-05-01" [datetime]$endDate = "2015-05-24" #note date is at 12 midnight #sample date Sunday, May 24, 2015 12:00:00 AM #search for the file Get-ChildItem -Path $path -Recurse | Where-Object CreationTime -ge $startDate | Where-Object CreationTime -le $endDate | Sort-Object ...
Read now
Unlock full access