$sourcefolder = "c:\1"
$targetFolder = "c:\2"
$filename = "1.txt"
$targetfile = Test-Path -Path "$targetFolder\$filename"
if ($targetfile -eq $false)
{
Write-Output "Here we go"
Copy-Item -Path $sourcefolder\$filename -Destination $targetFolder
}
else{
Write-Output "File aready exist in targetfolder"
}
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten