Recently, I purchased a 2tb external Western Digital My Passport USB 3.0 drive to store in house backups of movies, music, and photos that exist on my workstation. That seemed like a reasonable enough goal, but the answer wasn’t so straightforward.


Choosing A Solution

There were three basic options available to achieve my goal. The first, and most “obvious” solution was to use the sync solution that was included with the WD drive. After configuring the options, selecting the paths to be backed up and performing the first full backup, I quickly determined that that was not going to work for me. The software was resource intensive to the point of being obnoxious. I might have put up with that, but the software did not sync files properly after the full backup was performed.

The second option I briefly considered was using a commercial sync solution. I’ve used and have been happy with SyncBackPro but I really wasn’t interested in dropping another $40-$50 into the project unless it was absolutely necessary. I also wasn’t sure how a sync program would perform if the external drive was being regularly removed.

The last option was to use tools available in the Windows 7 OS to perform the work. I had an MS-DOS backup batch file located in one of my data directories that did basic backups of an older computer. This option seemed like the best of the three, how hard could it be?


Implementation

While getting the batch file to work wasn’t “hard”, it was harder than it needed to be due to Windows changing options on my chosen copy command. Of course, I didn’t read up on changes to the xcopy command, nor did I realize the deltree command had been removed. Given those issues, modifying the original script that looked like this ended with a series of errors:

DELTREE /Y \\SATAN98\DATABACK\*.*
XCOPY32 \\SATAN98\DELLDATA \\SATAN98\DATABACK /E /F /H /K /Y

Instead of trying to diagnose all the errors, I started from scratch. I ditched the Universal Naming Convention (UNC) notation and went with drive mappings. I then corrected the xcopy command, modified the switches, , used a rd command to replace the depreciated and no longer available deltree command, and broke the tasks down to path by path blocks. Now I have a series of batch blocks that look like this:

rd /s /q j:\databack   <- command only at beginning of batch file
echo Backing up Movies...
md j:\databack\movies
xcopy c:\movies j:\databack\movies /E /H /J /K /Q /Y

The batch file builds the directory structure as it proceeds block by block. The xcopy command copies the blocks of files one at a time, and I have a basic understanding of where the backup is with the echo statements.


Future Modifications

There are a few things I still need to do to transform this batch file from useable to ideal. First, the batch file is currently being executed with user level privileges. The end result of that decision is that files added to the system by my wife (with her account) throw “access denied” messages, and will abort remaining file backups in the current block of files being backed up. A brief investigation of this has revealed that there are several ways to accomplish this (Run as admin, shortcut with admin privs, an entry to the batch file itself, or using powershell). I just have to do it.

I’m also using a depreciated command to do the file backups. xcopy has been replaced with robocopy, a more robust copy command. Given my goal of wanting a solution up quickly, I initially chose xcopy. But that will likely disappear some time soon.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s