# 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 }