Context:
cp(1)
has -n
or --no-clobber
option. It makes cp
not overwrite existing files. This option is useful when you copy only newly created files.
Problem:
In PowerShell, Copy-Item
cmdlet doesn't have options equivalent to --no-clobber
of cp
. Copy-Item -Confirm
prompts you for confirmation even if there are no existing files on destination.
Solution:
You have to check existence of files on destination folder one by one.