We all know that backups are important, but we also know that few of us backup often.
We’re used to the cloud, but the cloud is not always a full replacement for physical backups. Some cloud services offer the possibility of recovering a previous version of a file but what if you made a big mistake and you want to compare two versions of a folder, for example?
Backups on external drives could be of help, but we probably prefer to avoid a full manual copy, especially if data at hand are enough to fill half of your hard disk.
Robocopy is a console command available in every Windows and it’s the perfect companion of our backup needs. And we’ll soon see why.
All you need to do is to create a batch file (just create a text file with notepad, anywhere, with the .bat extension, and Windows will execute the commands in it when the file is double-clicked) with the following two lines inside:
robocopy "c:\my folder" "d:\my folder copy" /mir /dst /ndl /ns /nc /im
pause
The magic of robocopy is that it allows an efficient copy, copying only the changed files. Also, it removes deleted folders/files from the destination. It creates a “mirror” of your source folder. So, your backup may take down to a few seconds, making it easy for making backups to become a habit.
How will you launch your backup procedure? Just double click on your batch file. No more than that.
The few options in the command line have the following meaning:
- /mir – That’s the only essential parameter. It tells robocopy to work in “mirror” mode.
- /dst – Daylight saving time may make robocopy copy some files even when not changed. This option takes care of avoiding this effect.
- /ndl – It simplifies the displayed results, excluding folders from them. Robocopy may be fast in checking and copying, but the visualization of a lot of folders – as strange as this seems – is not.
- /ns /nc – They reduce the details of the visualized output (file class and dimension).
- /im – It asks robocopy to strictly check the last modification date/time, and possibly copy, even when file size is not changed. This option may copy more files than needed and it’s not active by default. It’s not necessary, but it’s recommended if you want to be sure to have a perfect mirror backup.
The final pause command will let you see the final report of the operation.
You can check all the possible options by launching robocopy from the command prompt with the /? option.
In case you’re using USB drives for backups, you’ll probably want to look into how to handle the problem of variable drive letters.
Have a smart backup!