Robocopy - Is there anyway to copy upper & lower case file/folder renames?

1

1

Is there a command-line option or any way to get Robocopy to detect case changes/renames in files or folders on Windows? For example, If I rename source file 'example.txt' to 'Example.txt', Robocopy does not detect this rename and the changes are ignored and the file is not copied to the destination directory. This now leaves the destination directory out of sync from the source. Any suggestions on how to address or work around this issue would be much appreciated!

jtbrown3

Posted 2016-08-29T20:44:57.717

Reputation: 11

1

Windows is not case sensitive, so changing the casing should/will not affect Robocopy's ability to copy the file. Are you saying you want Robocopy to recopy it just because you changed the casing in the file name? If so the answer is "no", as Robocopy doesn't look at filename casing to determine if it's changed.

– Ƭᴇcʜιᴇ007 – 2016-08-29T20:48:25.797

1Thx for confirming NO. This is a defect IMHO because the casing of a file/folder name IS significant data - and Robocopy allows this to become unsynced while mirroring between source and destination directories. Not sure where one could petition Microsoft to correct/change this RoboCopy behavior... – jtbrown3 – 2016-09-13T08:02:20.873

Answers

0

Robocopy has a ' list only' command, also a verbose command, robocopy syntaxso the list only command could generate output of list of those files not copied (because robocopy deems them identical ) which you could massage in a spreadsheet to produce an input file allowing you to delete the problem files in the target directory, and then of course robocopy could copy them. Unfortunately you have not provided any detail of the scope of the task, so this note must fall short of a bells and whistles solution. Its the kind of task which can be done by scripting, but you have to decide whether the time debugging would be worth it.

pingpongpaddy

Posted 2016-08-29T20:44:57.717

Reputation: 9

Thx for the scripting idea. Probably too much work for the moment. The SyncBack Pro utility does provide an option to detect and propagate file/folder name case changes. – jtbrown3 – 2016-09-13T08:06:12.237

0

Windows is not case sensitive, meaning that mixed cases are considered to be identical. If you mirror (with the /MIR option) it will treat "source\Example.txt" and "destination\example.txt" as "identical" files, and as you said, it will not get copied because there is no need to copy an "identical" file.

I agree with the person that said that this is a defect, however, robocopy employs a heuristic based on timestamp and file size, so robocopy is "supposed to be" defective, or at least, not perfect.

One way to deal with it is to go to the destination and delete the file and then re-run Robocopy.

Another way is to "help" Robocopy detect a change by changing the timestamp or file-size of the file in the source. Changing the file content without altering the file-size and backdating the timestamp is probably not going to represent a change as far as Robobopy is concerned.

Lastly you might want to run cygwin "diff" in order to verify the work of robocopy. However, this verification itself is not perfect because cygwin is case-sensitive so instead of doing a comparison of files "example.txt" and "Example.txt" it will report that one is missing from the source and the other is missing from the destination. However, for the vast majority of files where this capitalization discrepancy is not happening, cygwin "diff" does serve to verify robocopy.

If you are not familiar with cygwin the only thing you need to know in order to do the diff is that C: drive is written as /cygdrive/c and D: drive is written as /cygdrive/d and just like in Linux and Unix the slash character is the separator. That is unlike Windows where the backslash is the separator.

Suppose for example, an original tree of "Documents" is on C: drive and a backup is on D: drive, the following cygwin command would verify the backup. (Adjust the paths to suit.)

diff --recursive --brief /cygdrive/c/users/userName/Documents /cygdrive/d/windowsbackup/Documents

H2ONaCl

Posted 2016-08-29T20:44:57.717

Reputation: 1 157