Hello all,
I found that Test-Path returns a $False even when a file exists. I created c:\temp\input.csv but it is not recognised by the script.
Clear-Host Write-Host "Test-Path" $FileName = "C:\temp\input.csv" if(Test-Path -Path $FileName) { Write-Host "The file $FileName exists"} else { Write-Host "The file $FileName does not exists." } Write-Host "[System.IO.DirectoryInfo]" [System.IO.DirectoryInfo]$file = "c:\temp\input.csv" $Froot = $file.Root.ToString() $Fparent = $file.Parent.ToString() $Fname = $file.Name.ToString() $FullName = $Froot + $Fparent + "\" + $Fname if(Test-Path -Path $FullName) { Write-Host "The file $FullName exists"} else { Write-Host "The file $FullName does not exists." }
And a picture:
I do something wrong here, but what?
Any help is appreciated.
With kind regards,
Willem-Jan