robocopy /mir changes destination folder name-how to prevent that

4

1

When I run a robocopy batch file that reads:

robocopy "C:\Users\mgo\Documents" "E:\Documents backup on the UltraBay drive" /mir

the destination folder gets renamed to "E:\My documents" WHY? How to keep that from happening? What arguments can I use to preserve the destination folder name?

This only happens when doing robocopy from a SYSTEM folder (My documents, My pictures, etc) but not when I create a non-system folder and copy the contents to a non-system destination folder that I created. Then the destination folder name does not change. Obviously, it's a Library/System folder thing...

mgo

Posted 2013-03-17T16:19:37.963

Reputation: 66

Answers

4

You need to exclude desktop.ini which tells windows how to display the name of the My Documents folder. The switch /XF desktop.ini will do this.

Use the following:

robocopy "C:\Users\mgo\Documents" "E:\Documents backup on the UltraBay drive" /mir /XF desktop.ini

Garth Oates

Posted 2013-03-17T16:19:37.963

Reputation: 193

1I tried this out, it works. you can also go in after the copy and delete the desktop.ini file manually. It's a hidden system file so you have to change your view settings. – Doltknuckle – 2014-05-13T17:49:21.190

1

I believe it is because the actual directory is named "My Documents". If you go into Windows Explorer, start at C and drill down into the users directory into the users profile you will see that it is actually called "My Documents". Documents is similar to a shortcut and is not the true folder name.

Joe Frederick

Posted 2013-03-17T16:19:37.963

Reputation: 11

-2

Here's what I do:

robocopy %USERPROFILE%\Desktop   %DRIVE%%BACKUPFOLDERNAME%\Desktop   /COPY:DAT /A /S /FFT /R:0 /W:30 /TEE /ETA /XO /LOG:"%USERPROFILE%\Documents\backuplogs\my_desktop.txt" 
robocopy %USERPROFILE%\Favorites %DRIVE%%BACKUPFOLDERNAME%\Favorites /COPY:DAT /A /S /FFT /R:0 /W:30 /TEE /ETA /XO /LOG:"%USERPROFILE%\Documents\backuplogs\my_favorites.txt"
robocopy %USERPROFILE%\Documents %DRIVE%%BACKUPFOLDERNAME%\Documents /COPY:DAT /A /S /FFT /R:0 /W:30 /TEE /ETA /XO /LOG:"%USERPROFILE%\Documents\backuplogs\my_documents.txt"
robocopy %USERPROFILE%\Downloads %DRIVE%%BACKUPFOLDERNAME%\Downloads /COPY:DAT /A /S /FFT /R:0 /W:30 /TEE /ETA /XO /LOG:"%USERPROFILE%\Documents\backuplogs\my_dowloads.txt"
robocopy %USERPROFILE%\Music     %DRIVE%%BACKUPFOLDERNAME%\Music     /COPY:DAT /A /S /FFT /R:0 /W:30 /TEE /ETA /XO /LOG:"%USERPROFILE%\Documents\backuplogs\my_music.txt"
robocopy %USERPROFILE%\Pictures  %DRIVE%%BACKUPFOLDERNAME%\Pictures  /COPY:DAT /A /S /FFT /R:0 /W:30 /TEE /ETA /XO /LOG:"%USERPROFILE%\Documents\backuplogs\my_pictures.txt"
robocopy %USERPROFILE%\Videos    %DRIVE%%BACKUPFOLDERNAME%\Videos    /COPY:DAT /A /S /FFT /R:0 /W:30 /TEE /ETA /XO /LOG:"%USERPROFILE%\Documents\backuplogs\my_videos.txt"

Steve

Posted 2013-03-17T16:19:37.963

Reputation: 1

While you've provided code, this answer lacks any explanation of the the code. – Jason Aller – 2014-05-13T17:43:41.607