Friday, May 4, 2012

Check if files exist using PowerShell

The file controls.txt contains a list of filenames with path.
We want to find non existent files

cat .\controls.txt | Where-Object {-not (test-path $_)}

Get unique sorted lines from file and save to another file.
cat .\controls.txt | Sort-Object | Get-Unique > .\controls-sorted.txt

No comments:

Post a Comment