How to Back Up Data / Synchronize Files and Folders Automatically without any Software


If you want to take a backup of your data or synchronize files and folders between your external storage device and your hard disk automatically, How will you do it? Well, Copying files from one destination is a no brainer and is definitely one of the simplest tasks that anyone can execute. But what if the need is to copy only a couple of files or folders that have either been changed or created? While transferring them one by one is an option, it is quite a time consuming task. There are a number of software utilities that will do the trick but that is not exactly what we are looking forward to do. Lets see how we can do the data back up and synchronization without using any third party software.

Windows itself comes with a built in data backup and synchronization tool. Robocopy or Robust File and Folder Copy, as some call it, is a powerful little command line tool that allows you to copy as well as synchronize files. Since this tool is completely a command line based tool it is devoid of any fancy GUI. You will need to type “robocopy.exe” followed by the source folder and then the destination folder in the command prompt. There are also a number of wild card entries that you can use to enhance the overall copy process.

Now, if you want to copy the contents of a particular folder to a specified destination, for example a pendrive, memory chip or external drive,

Open command prompt by going to “All programs > Accessories > Command prompt”. Now type the following commands as shown in the example:

robocopy “Source folder” “Destination folder” [command options]

Example : robocopy.exe c:\pcsplace e:\pcsplace_backup /copyall /purge /mir /e /log+:c:\rbcpy.txt

 robocopy - back up synchronize automatically

This is what the command means:

  • robocopy.exe – this entry allows Windows to run robocopy
  • c:\pcsplace – the source folder that needs to be copied
  • e:\pcsplace_ backup – destination where the files need to be copied to
  • /copyall – copies only files within the folder
  • /purge – deletes destination files and folders that are non-existant in the source folder
  • /mir – copies the entire folder content (including sub-folders)
  • /e – copies subdirectories, including empty ones
  • /log+:c:\rbcpy.txt – generates a LOG file at the specified destination and appends it to an existing log.

You can make file transfers even simpler by creating a batch file. The advantage of creating a batch file is the ability to copy multiple files and folders from various partitions at a time.

Example:
Open notepad and type the following command:

@ECHO OFF
echo Do you want to continue with
the transfer?
CHOICE
IF errorlevel 2 goto ABORT
IF errorlevel 1 goto COPY
:COPY
Robocopy c:\pcsplace i:\pcsplace /copyall /purge /mir /e
Robocopy c:\pcsplace\images i:\images/copyall /purge /mir /e
ECHO ******************************
ECHO **ALL FILES HAVE BEEN COPIED**
ECHO ******************************
PAUSE
cls
exit
:ABORT
ECHO ******************************
ECHO ****** FILE COPY ABORTED *****
ECHO ******************************
PAUSE
cls
EXIT

For the above example you will only require to change the ones that are highlighted in red while leaving the rest as it is. After you are done adding the folders that need to be backed up save the file. For that click on “File > Save as”. Change the “Save as type” to “All files” and save the file as “My_BkUp.bat”.

Note: You can name the file to whatever you please but you will need to save it with a “.bat” extension. Depending on the amount of data that needs to be backed up the first run might take a little time. All other consecutive runs will check and update modified and newly created files.

Another handy process is the file and folder monitoring option. You can either specify it to run when a specified number of changes occur or set it to scan for changes in a given timeframe.

Robocopy “c:\pcsplace” “e:\pcsplace _ backup” /copyall /purge /mir /e /mon:2

Here “/mon:2” basically specifies the command to run whenever there are at least two changes detected. However, if you want the backup to run at regular intervals interchange “/mon:?” with “/mot:m” where “m” specifies the waiting time in minutes.

Remember that the files will be overwritten once you proceed with the copy process. The commands might look tough to remember but once you get the hang of it you wouldn’t like to try out anything else for transferring your files. If you are eager to give it a shot, you can get your hands on a whole list of commands by simply going to http://ss64.com/nt/robocopy.html.

Leave a Reply