Wednesday, April 11, 2018

Batch command to emulate Windows "Replace or Skip" options when copying or moving files

In Windows 10 File Explorer, I attempt to copy or move x.txt into a folder already containing a file named x.txt. Windows gives me a dialog offering a choice: Replace the file in the destination, Skip this file, or Compare info for both files.


If I choose Compare Info, I get an option to put a checkmark next to both files. In the destination folder, that option gives me x.txt and x (2).txt. So both files exist in the destination, but the name of one has been altered by appending (2) or, if x (2).txt already exists, the appended numbers will be (3), (4), ....


Is there a command, suitable for use in a batch file, that will produce that outcome? I would like to automate the copying or moving of files into a single folder, where files having the same names already exist in that folder. As far as I can tell, this functionality is not available in copy, move, or xcopy commands.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...