Having XCopy copy a file and not overwrite the previous one if it exists (without prompting)

Vic picture Vic · Mar 1, 2011 · Viewed 71.9k times · Source

I'm sending a commands to a remote computer in order to have it copy a file. I want the file to be copied, but not to overwrite the previous file with the same name (if it exists). I also need the command to run without any prompts (xcopy likes to prompt whether the target name I've specified is file or directory, and it will also prompt about overwriting a file).

Answer

Daniel Mošmondor picture Daniel Mošmondor · Mar 18, 2013

I have good results with xcopy /d.

It will copy NEWER files, and since we can assume that existing files have same time-stamp, you will copy only files that don't exist.