Question : powershell if file exists
Answered by : antti-veikkolainen
# Check if file doesn't exists
if (-not(Test-Path -Path "$directory/$file" -PathType Leaf)) { # File doesn't exist
}
# Check if file does exists
if (Test-Path -Path "$directory/$file" -PathType Leaf) { # File does exist
}
Source : https://adamtheautomator.com/powershell-check-if-file-exists/ | Last Update : Mon, 13 Sep 21
Question : powershell check if file exists
Answered by : doge-amazedo
Test-Path <path to file> -PathType Leaf
Source : https://stackoverflow.com/questions/31879814/check-if-a-file-exists-or-not-in-windows-powershell/31881297 | Last Update : Thu, 08 Jul 21