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

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.


just in case anyone else finds this: robocopy x:\sourcefolder Y:\destfolder /s /e /r:0 /z

much better than xcopy, even gives you a table at the end informing of any failed or skipped files. Doesn't prompt to not overwrite.


Well, there's a certain remedy! It has helped me with saving much of my effort and time on Win10 while writing a setup for our product demo.

Just try to use piping:

@ECHO N|COPY /-Y SourceFiles Destination

As an example I used this piece of code so that I would have a clean gentle quiet and safe copy!

@FOR /D %%F in ("FooPath") DO @(
   @ECHO N|COPY /-Y ^"%%~npdxF\*.*^" ^"GooPath^" 3>NUL 2>NUL >NUL
)

where obviously FooPath is the source and GooPath is the destination.

Enjoy!

(main source: https://ss64.com/nt/copy.html)

Tags:

Xcopy