Sync files with your NAS

I have my main workstation (Windows 7 64 bit) connected to a USB hub having connecting cables for my scanner, camera, webcam, handycam etc. All these external devices deliver content into my “Users” folder. The goal then is to have content in the “Pictures”, “Videos” and “Documents” folder in my main workstation transferred automatically to my DNS-323 NAS so that

  1. Files are backed up
  2. Files are easily accessible from any computer in my network

“Sync” and “Backup” are two commonly used (or misused) terms to describe the above. Here are the important differences between the two:

  • A “Backup” file is not usually human readable.. it needs to be “Restored” using the software that created the backup
  • Sync is 2-Way while Backup is 1-Way (although, depending on the software employed, you could set “master-slave” rules that mimic a backup plan)
  • While both Sync and Backup are incremental in nature, Backup additionally employs some compression on your files in order to reduce storage space. Sync utilizes exactly the same space on the source and destination.

Having decided that “Sync” was the better option for me, I found that a tool named “SyncToy” from Microsoft satisfied my requirements exactly. I just love the simplicity of its user interface!  Whats more, it is FREE, works exactly as advertised,  has a small footprint (~1 MB), and works natively on 64 bit windows (As an aside, I really think Microsoft should have incorporated this into “Live Mesh” – another sync tool offered by MS that syncs with its cloud based storage).

One shortcoming (if you want to call it that), is that SyncToy does not offer “automatic or scheduled syncing”. It is however pretty trivial to set this up using the built in Task Scheduler in Windows 7 (described below).

Here’s how I setup SyncToy on my main desktop:

image

Note that I use the static IP address assigned to my NAS in the “Right Folder”. Please refer to my blog on how I setup my NAS for additional information.

Pay particular attention to the options presented on the next screen.. This forms the core of your sync strategy. “Echo” works nicely for my setup.. but you might want to select “Contribute” if you do not want to propagate deletes.

image

image

Repeat the process for all folders on your workstation that you want to sync to your NAS. You are done setting up the sync rules at this point. You can click on the “Preview button” to view all the files/actions.

Using Task Scheduler to schedule the sync:

Although SyncToy can be run on demand anytime, Automating the process gives you the confidence that your invaluble docs, pics etc are safely synced on a regular basis (I strongly recommend you check the logs the first couple of times just to ensure that all went well).

Click on the Start menu, then select All Programs –> Accessories > System Tools –>Task Scheduler

(Alternatively, you can simply search for “Scheduler” in the win 7 search box).

Click on “Create Basic Task”:

image

Enter a name for your job.. and a brief description:

image

Next up, the trigger event. I setup mine to sync every week. You may want to tweak this depending on your circumstance… You can get REALLY granular ..Feel free to explore the available options.

image

(Note that you SHOULD NOT select “When the computer starts” because it fires prior to login.. so neither your security credentials nor your LAN connection is ready at the time)

image

image

Under “Program/Script”, click on Browse button and locate the SyncToyCmd.exe – Note: Select SyncToyCmd (command line version) and NOT SyncToy(GUI). In the “Arguments” field, enter “-R” (for running all the sync folders setup).

image

Finish up.. and you are done with the scheduling process.

Hiding the command window:

When the scheduled process runs, it brings up a DOS command window (“taskeng.exe”) displaying the progress of the sync operation. This may not be acceptable to some. Here’s how you can suppress it:

1. Create a file named “Auto.vbs” (Ofcourse you can call it anything, I chose “Auto”) in your SyncToy folder with the following contents:

Set WshShell = CreateObject(“WScript.Shell”)
WshShell.Run Chr(34) & “C:\Program Files\SyncToy 2.1\SyncToyCmd” & Chr(34) & ” -R”, 0
Set WshShell = Nothing

2. Edit the scheduler script that was setup earlier to execute “Auto.vbs” instead of “SyncToyCmd.exe” (Remember to remove the –R switch from the arguments field as it is already included in the script)

Editing an existing scheduled operation using the task scheduler is actually a little convoluted.. You have to double click on the task.. then, select “Properties” from the right side action pane. This opens up the task for edits.

Note that once you have the basic scheduling in place, you can add any number of folders to SyncToy and it will be handled automatically during the next Sync!

Advertisements

7 thoughts on “Sync files with your NAS

  1. Hello,
    I have been trying to sync folders between my PC and NAS. I like the fact that one can use free Microsoft tools – your solution is simple and elegant. Thanks a lot for the useful post!

    Cheers,

    Slava

  2. I have used SyncToy in the past and I liked it’s simple, no fuss interface. However I found it choked once I tried using to Sync lots of data. Thousands of music files for example.

    I bought a license for AllwaySync for my main PC but I have also used Synkron and quite like that. I’ve just bought a NAS so I will testing these last two apps to see how they perform.

  3. Thanks for the guide, it was very helpful to me also….but your vbscript at the end didn’t work for me….
    1st – invalid character: line 1 col 29….so I deleted the quotation makes in line 1
    2nd – invalid character: line 2 col 24….didn’t get beyond this, it seems to have a problem with quotation marks (sorry, I don’t know anything about scripting).

    1. Hi,
      Wordpress adds a special/curved double quote mark.. I recommend copying the code into notepad and replacing ALL the double quotes with straight double quotes.

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