Computer Backup With Robocopy

There are lots of backup solutions out there but a lot of them seem to be overly complicated to me. A lot of the software we have now days seems to be overly complicated but that is a rant for another time. That is why I started using a simple robocopy script to do most of the work when I am backing up data on Windows.

If you are looking for backup options for Linux I have a post about Rsync you can check out. Otherwise, keep on reading! 🙂

Backup Hard Drives With Robocopy

I have always been a little obsessive when it comes to backups but I have never lost data I could not get back. So I guess that means I am lucky or I am doing something right.

Organize Your Files To Make Backups Simpler

The first step is to make sure your files are well organized and not scattered all over your computer. Otherwise, it is easy to miss things and you end up not having them backed up.

For example, I try to save everything in my documents folder other than pictures and music. This way I can just back up the documents folder and know I have almost everything.

Ones your files are organized into just a few locations then you only have a few places to backup. It makes things much easier to work with.

My Robocopy Backup Routine

I have a simple backup script on my desktop. When used it starts to robocopy everything on my Desktop to a network share. It also copies everything in Documents, Music, and Pictures. I even add game save locations of the current game I am playing if it is not already in the documents folder.

I have a script like this on all my computers copying to their own folder on the network share.

Then I have another script that robocopys the whole backup share to a 2TB hard drive I have. In fact, I have a few big hard drives laying around so I kind of rotate them. This way if my network server dies I still have everything backed up. To make it easier I use a hard drive dock.

Then the last step to my robocopy backup routine is to take one of the hard drives to my parent’s house when I go to visit. That way if God forbid my house ever burned down I would still have my file safely at another location.

Making Your Own Robocopy Backup Script

Ok so now that you know my process lets show you how to make your own script.

Robocopy is very easy to use. You just have to open up a command prompt and type the command or save the commands to a .bat file to be clicked later.

If you open a command prompt and type robocopy it will give you some info on how to use it.

Robocopy usage

And here is an example of copying my documents folder to my network share.

robocopy "C:\Users\Zack\Documents" "\\\nas\Backups\Zack\Computer Backup\Documents" /MIR

And here is how you could backup to an extra hard drive. You could also point this to a USB drive if the data will fit on it.

robocopy "C:\Users\Zack\Documents" "D:\Backup\Documents" /MIR

Robocopy Options

I use the /MIR option to mirrors the source folder. There are lots of other options too but I have only ever needed a few of them.

I have used “/XJD” and “/XJF” to keep my backup clean by ignoring junction points in the file system. But nowadays I do not think this is a big deal. I still have it on my saved scripts but I don’t use it when typing a command in.

The other one I have used is to limit the retry attempts. /r:<N> Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries).

If a file is being used you may want your script to move on instead of waiting forever.

Things to watch out for

Always double-check the command before you hit enter. If you reversed the source and destination then all the files you want to backup could be deleted.

I have also noticed some file system issues creeping in on my big hard drives. Maybe because my backup is so big, the disk was getting full, or NTFS is not very good. I am not sure at this point.

Whatever the case I decided to add a check disk command to my script to catch any problems before they get worse.


I also run a file integrity monitoring script to check for file corruption.

One more thing to watch out for is there is no file versioning when backing up files with robocopy. This is why I like to rotate my backup drives.

My Backup Script

Here is the script on my desktop to backup to my network share. REM stands for remark and is just a way to comment your code.

robocopy "C:\Users\Zack\Desktop" "\\\nas\Backups\Zack\Computer Backup\Desktop" /MIR /XJD /XJF
robocopy "C:\Users\Zack\Documents" "\\\nas\Backups\Zack\Computer Backup\Documents" /MIR /XJD /XJF
robocopy "C:\Users\Zack\Music" "\\\nas\Backups\Zack\Computer Backup\Music" /MIR /XJD /XJF
robocopy "C:\Users\Zack\Pictures" "\\\nas\Backups\Zack\Computer Backup\Pictures" /MIR /XJD /XJF

REM Game Backups
robocopy "C:\Games\Steam\steamapps\common" "\\\nas\Backups\Zack\Computer Backup\Steam" /MIR /XJD /XJF

REM SVN Server
robocopy "\\\svn" "\\\nas\Backups\Zack\SVN Server" /MIR /XJD /XJF

REM Game Saves
robocopy "C:\Games\VtMB\Unofficial_Patch\save" "\\\nas\Backups\VtMB Saves" /MIR /XJD /XJF

And here is the script to backup the network share to a hard drive.


robocopy "\\\nas" "D:\NAS Backup" /MIR /XJD /XJF

REM Save the date and time of the last backup to a text file on the drive.
echo %date% %time% > %~dp0LastBackup.txt


Cloud Backup

I will still recommend a cloud backup as a final line of defense. There is always a chance that a major disaster will destroy your house and backups.

You could put the cloud backup software on the computer hosting the network share. Or if one of your backup hard drives is in your computer then the cloud backup software could run on your computer.

Then you still have the benefits of a cloud backup for all your devices. But you only have to install, manage and pay for the software on 1 computer. Then use the simple robocopy scripts to do everything else!

I personally use a combo of robocopy and iDrive to backup my most precious data. Things like family pictures that can never be replaced.

But for other big data, I only use my robocopy scripts so I am not taking up too much room on my backup account.

What do you do for backups?

This is what I do but it may not be the best. How do you backup your data? I would love to hear about it in the comments below!

Leave a Reply

Your email address will not be published. Required fields are marked *