Rather than talking about how important data backups are I thought I would take the time to show you how you can use tools that are free or low cost to automate backups using Dropbox. If you don’t have a Dropbox account then I strongly urge you to grab on and why not since it free for the first 2Gb. By using Dropbox you can access your data from any device that has internet connectivity. However the purpose of this article is to show you just how easy it is to perform backups.
Tools
- Robocopy: is a command-line directory replication command. It has been available as part of the Windows Resource Kit starting with Windows NT 4.0, and was introduced as a standard feature of Windows Vista, Windows 7 and Windows Server 2008.
- 7Zip: An open source file archive designed originally for Microsoft Windows. 7-Zip operates with the 7z archive format, and can read and write several other archive formats. The program can be used from a command line interface, graphical user interface, or Windows shell integration. 7-Zip began in 1999 and is actively developed by Igor Pavlov. It is related to a cross-platform port, p7zip.
- Of course a Dropbox account.
- Your favorite text editor.
The Batch File Broken Down
Now it is important to understand that my intent is to demonstrate how to backup items such as your favorites, email, and anything else that you deem important. I will not go into the details of the command line switches as they apply to 7Zip and Robocopy rather I will explain the use in my example.
First, define the variables. I prefer this method because it is clean and provides a single line item.
:: variables
set dailyDrive=C:\Users\SomeUser\Dropbox\Backup
set backupCmd=robocopy /S /Z /COPY:DAT /MIR
set zipCmd="C:\Program Files\7-Zip\7z.exe" a -tzip
So what is really happening here?
- dailyDrive defines where my backup is stored (remember by using Dropbox it automatically syncs to the cloud)
- backupCmd defines the robocopy executable and the switches
/S :: copy Subdirectories, but not empty ones
/Copy:DAT :: What to COPY (default is /COPY:DAT)
/Z :: copy files in restartable mode
/MIR :: Mirror a directory tree (equivalent to /E plus /PURGE)
- zipCmd defines the 7Zip executable and the switches
a :: This command stands for ‘archive’ or ‘add’. Use it to put files in an archive.
-tzip :: format zip
I use to goto statements to both run the backup as well as exiting once complete.
:FULL_BACKUP
echo ### Backing up Favorites...
%backupCmd% "%USERPROFILE%\Favorites" "%dailyDrive%\Favorites"
echo ### Compress and Backing up Email...
%zipCmd% C:\Users\SomeUser\Dropbox\Backup\Email\email.zip "%USERPROFILE%\Documents\Outlook Files"\*.pst"
echo ### Backing up Wallpaper...
%backupCmd% "%USERPROFILE%\Documents\Wallpaper" "%dailyDrive%\Wallpaper"
cls
Echo Congratulations you have backed up your data!
goto EXIT_BACKUP
:EXIT_BACKUP
exit
It is important to state that “%USERPROFILE%” is simply the environment variable within Windows for the individual. In the example above I am performing three basic actions:
- Backing of up my favorites
- Compressing and backing up my email
- Backing up my wallpapers
While there is much more data you may wish to backup this should clearly demonstrate how to get started. For example, say you have a folder called “TaxRecords”, all you need to do is add the following to the batch file.
echo ### Backing up the user defined data...
%backupcmd% " c:\TaxRecords" %drive%\TaxRecords"
Finally, add the batch file as a scheduled task or as a start-up item to execute each time you log into Windows. Upon execution you will see a command window similar to the following:

Complete Batch File
@echo off
:: variables
set dailyDrive=C:\Users\SomeUser\Dropbox\Backup
set backupCmd=robocopy /S /Z /COPY:DAT /MIR
set zipCmd="C:\Program Files\7-Zip\7z.exe" a -tzip
cls
goto FULL_BACKUP
:FULL_BACKUP
echo ### Backing up Favorites...
%backupCmd% "%USERPROFILE%\Favorites" "%dailyDrive%\Favorites"
echo ### Compress and Backing up Email...
%zipCmd% C:\Users\SomeUserDropbox\BackupEmail\email.zip "%USERPROFILE%DocumentsOutlook Files"\*.pst"
echo ### Backing up Wallpaper...
%backupCmd% "%USERPROFILE%\Documents\Wallpaper" "%dailyDrive%\Wallpaper"
cls
Echo Congratulations you have backed up your data!
goto EXIT_BACKUP
:EXIT_BACKUP
exit
Conclusion
That is all it takes to backup your important data all without spending anything. Of course as your data needs grow there may be a time that you find yourself needed more than the free 2GB that Dropbox provides and cost for additional space is very reasonable.
Do you have any tips on data backups? If so, leave a comment.
Recent Comments