I have a pretty basic powershell copy script that copies items from a source folder to a destination folder. However this is moving way too much data, and I'd like to check if the filename already exists so that file can be ignored. I don't need this as complex as verifying created date/checksum/etc.
Currently it's along the lines of:
Copy-Item source destination -recurse
Copy-Item source2 destination2 -recurse
I'd imagine I need to add the Test-Path cmdlet, but I'm uncertain how to implement it.
Best Answer
You could always call
ROBOCOPY
fromPowerShell
for this.Use the /xc (exclude changed) /xn (exclude newer) and /xo (exclude older) flags:
This will ONLY copy those files that are not in the destination folder.
For more option type
robocopy /?