Click here to Skip to main content
Click here to Skip to main content

Backing up My Documents in Windows 7 with robocopy

, 20 Jul 2012
Rate this:
Please Sign up or sign in to vote.
How to use robocopy to backup your My Documents Folder

Backing up your My Documents folder in Windows 7

This should be as easy as something like:

robocopy c:\users\vince\Documents \\remotestoragelocation\foldername /MIR

The /MIR switch will mirror the first folder onto the second folder (Keep in mind this will also remove the files you delete), If you want to just copy the files and not delete the ones you have deleted in your backup then you can use /E instead of /MIR

The tricky part is that you may encounter an error when it gets to a few folders like My Music etc... This is because they are junction folders and they won't copy properly.

Don't worry you can still backup your Documents Folder and skip those Junction folders. You just need to also use the /XJ switch.

robocopy c:\users\vince\Documents \\remotestoragelocation\foldername /MIR /XJ
or
robocopy c:\users\vince\Documents \\remotestoragelocation\foldername /E /XJ

Now in the documentation it says the /XJ switch is "Normally included by default" however Normally doesn't mean always. So put it in to be safe.

You can put this into a .bat file or set it up as scheduled task to be run periodically. For me personaly as an Admin I don't like to use scheduled tasks for backups. The reason is that a scheduled task is typically setup once and forgotten about. It will run perfectly fine for the most part. However I have seen windows updates, persmisions, folder name changes etc... that can mess up your task and you don't even know it hasn't been running for months until you need to do a restore and nothing is there. You can of course setup some notification system for your task but then you need to monitor for that notification system. What if that fails? Are you monitoring your notification system? Is it redundant?

It is a far better option in my mind to put this on the end user to mindfully click on the backup bat file. Once it becomes a habbit to do this its a quick thing to do and they can be assured it completes without error.

There are of course other options for backing up like an Server side backup system, windows backup, ziping or raring your files to an archive, but for MyDocuments a /MIR or /E is usually good enough. It also a bit less fumbly for people to find there files in case they need to. Also sometimes you just want to make a quick copy.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Vince Yonemitsu
Systems / Hardware Administrator Code Project Solutions Inc.
United States United States
I did my schooling at Humber College in the late 90's when everyone was trying to learn how to fix Y2K bugs in COBOL. It was then that I decided that I wanted nothing to do with programming. When all was said and done I have spent the last 12 years (and growing) in various Networking, Support, and Server Management positions for various private and public sector employers. It’s funny how I have now come full circle and I am again surrounded by programmers. Smile | :)
 
When I manage to get away from the office I am usually fishing, off-roading, golfing, canoeing or camping. Pretty much anything that keeps me outside. Actually I just bought my first DSLR camera and I think its going to soak up much of my time and resources over the next little while.

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
RA-Web1 | 2.8.140721.1 | Last Updated 20 Jul 2012
Article Copyright 2012 by Vince Yonemitsu
Everything else Copyright © RootAdmin, 1999-2014
Terms of Service
Layout: fixed | fluid