# find long paths: import-csv .\D_manifest.csv | Where {[int]($_.FullPathLength) -ge 248} | export-csv longpaths.csv # find files modified in a certain date range: $from_date = (new-object System.DateTime 2012, 12, 15) $to_date = (new-object System.DateTime 2012, 12, 21) import-csv .\D_manifest.csv | Where {[datetime]($_.LastWriteTime) -ge $from_date -and [datetime]($_.LastWriteTime) -le $to_date} | export-csv indaterange.csv # find files that are 100 MB or larger: import-csv .\D_manifest.csv | Where {[long]($_.Length) -ge 100*1024*1024} | export-csv bigfiles.csv # search for files whose names contain "_i.php" (uses select-string because # csv parsing unnecessary): select-string .\D_manifest.csv -pattern "_i\.php" | %{ $_.line } | Out-File -Encoding ascii -FilePath searchresults.csv # note: this last one can search multiple CSV files at once; select-string # supports wildcard filenames like *.csv # find total size of all files in E:\Shares\Misc: # (special note: normally, the powershell escape character is `, but in regexps # it's \, except if what you're trying to escape is a dollar sign; then '\$' # doesn't work and the escape sequence is '[$]'.) # takes 3 minutes: $sum = 0 import-csv .\E_manifest.csv | foreach-object { if ($_.FullName -match "E:\\Shares\\Misc") {$sum += [long]$_.length} } $sum # takes 1.5 minutes: $sum = 0 select-string .\E_manifest.csv -pattern "E:\\Shares\\Misc" | %{ ($_.line -match '^"[^"]+","([^"]+)"' | out-null); $sum += [long]($Matches[1]) } $sum # takes 1 minute: $sum = 0 $reader = New-Object IO.StreamReader 'E_manifest.csv' while(($line = $reader.ReadLine()) -ne $null) { if ($line -match "E:\\Shares\\Misc") { $line -match '^"[^"]+","([^"]+)"' | out-null $sum += [long]($Matches[1]) } } $reader.Close() $sum