Last active
August 29, 2015 14:16
-
-
Save jacefreeman/8f05fc560340f7abcea5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# Import a CSV and use it to check for a files existence, writing the output to a file #> | |
<# Seems to output whole array instead of just the value, annoying #> | |
<# Fail 1#> | |
$csv = Import-csv .\no_files.csv | select-object -Property DocumentNo, AttachNo, AttTitle, FilePath | ForEach-Object { if ((Test-Path -Path $_.FilePath) -eq $true) { write-host "$_.FilePath exists"} else { write-host "$_.FilePath missing"}} | Export-CSV recfind_ledger.csv -NoTypeInformation | |
<# Succesful Code #> | |
Import-csv '.\no_files.csv' | select @{n='DecRegistrationNo';e={$_.DecRegistrationNo}}, @{n='Path'; e={$_.FilePath}}, @{n='Exists';e={Test-Path -LiteralPath $_.FilePath}} | Export-CSV 'csv_out.csv' -NoType |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment