Skip to content

Instantly share code, notes, and snippets.

@thomasrayner
Last active June 28, 2016 15:21
Show Gist options
  • Save thomasrayner/1c671eb31a95878cc7bcf32608c90a80 to your computer and use it in GitHub Desktop.
Save thomasrayner/1c671eb31a95878cc7bcf32608c90a80 to your computer and use it in GitHub Desktop.
$filefrom = 'c:\temp\something.txt'
$fileto = 'c:\temp\1\something.txt'
if (-not (test-path $fileto))
{
$opts = @{'path' = $filefrom; 'destination' = $fileto; 'confirm' = $false}
copy-item @opts
}
else
{
$opts = @{'path' = $filefrom; 'destination' = $fileto; 'confirm' = $true}
copy-item @opts
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment