Setting up Google Drive Sync to automatically update from PC to Google Cloud

Screens

I cannot find a built in method for automated syncing from your local machine to your Google drive from within the Google drive app itself.  Here is the process I go through on every machine that I would like to have access to my personal docs.

I use SyncToy 2.1 along with the Google Drive app.

Note: I place commands between tick marks (‘).  Do not include the tick mark or the preceding or trailing white spaces when entering the commands listed here.  Keep in mind that this does not apply to Quote marks (“).  Quote marks must be entered as shown.

  • Install the Google drive app.
  • It will create a folder on your machine called Google Drive.
  • Create the structure you want by creating your folder structure on the Google drive site.
  • Let it download your changes from the cloud.
  • Check the Google drive folder to insure that the structure is as you want it.  By default, on windows 8, this will be installed to “C:\users\username\Google Drive”
  • Download SyncToy 2.1 from the MS site.
  • Install SyncToy.
  • Execute SyncToy.
  • Create a new folder pair.
  • Add your left folder as the folder you wish updated from your local machine.
  • Add your right folder as the folder you wish to update to on Google Drive.
  • Synchronize: This is what I use for most syncs.  It will not delete files either direction, and will make sure that all files exist in both locations.
  • Echo: It will copy everything from the left to the right.  Deletes and renames on the left will also get pushed.  This is great for keeping a repository up to date from only one machine.  Can be viewed as a method for keeping an online backup available.  Do not use if you have multiple machines connecting to the same folder as each time you set this up it will update with the folder on the current local machine and will delete anything on Google drive that does not exist locally.
  • Contribute: This is a repository selection.  It will handle multiple local machines copying from left to right.  Does not process any deletes on the right.  Will ensure that your Google Drive folder contains everything from contributing machines.  You will have to manually delete anything on Google Drive that you don’t want any more.

I’ll be using the ‘Contribute option’ for this process.  I use multiple machines for personal work and want my Google drive to have a copy of everything I store locally that is personal.

So I set up:

  • Left Folder: \mydocs\personal
  • Right Folder: \googledocs\personal\docs
  • Contribute
  • Name your folder pair and preview.  It will show you what it is planning on doing. Watch specifically for Delete or Rename items.
  • If everything looks as you expect it, hit run.

You can make as many of these folder pairs as you would like.  If this is on a work computer, make sure you review your Data Management/Classification Policy.  I keep my personal files and work files separate on all machines so I won’t be going into any details on this.

If everything goes as expected and you do not want to automate the sync, than you can finish here.  If you would like to automate the process, keep going.

Note:  If you are going on to automate the sync process, make sure that you check the active status of your pairs by:

  • Open the SyncToy interface.
  • Click on ‘All Folder Pairs’ in the left bar.
  • Verify that each Active box that you wish automated is checked.

To automate this we need to use the “CMD exe” that comes with SyncToy.  If you selected defaults during the SyncToy installation:

  • It is located at either:
    • “C:\Program Files\SyncToy 2.1\SyncToyCmd.exe”
    • “C:\Program Files(x86)\SyncToy 2.1\SyncToyCmd.exe”.
  • Verify this location before proceeding.

Open up a CMD window.  You can do this by:

  • Hit the Windows Key and R simultaneously.  In the box that pops up, type in ‘ cmd ‘ and hit ok.
  • Type in ”C:\Program Files\SyncToy 2.1\SyncToyCmd.exe” or “C:\Program Files(x86)\SyncToy 2.1\SyncToyCmd.exe” into the cmd window and hit enter.
  • If all is correct you will receive a few lines of help regarding the switches the SynToyCmd.exe will accept.

Now, assuming that everything went correctly in the above step, Type the following into the cmd box:

  •  “C:\Program Files\SyncToy 2.1\SyncToyCmd.exe” -R

If the sync worked correctly, you will see output indicating how much and what was transferred.  Right now I am dropping the results.  I may come back later and capture this in an email or event log.

If that went as expected, then it is time to create our task and tie it to a trigger.  I would love if Windows would implement something like the Linux inotify.  But as I have found no direct way to receive this sort of notification on folder change to cause a trigger, we are stuck attaching to a simple datetime.

  • Open up your task scheduler.  This is different based on version of Windows.  For XP or 2003 and prior, just hit start, run and type tasks.  That will bring it up.
  • For windows 7/2008 and later, open explorer, right click computer then click manage.  It will be one of the top items.  (For those who want to create an easier way to get this, just pop up an mmc console, hit Ctrl-M and add the Task Scheduler then save it wherever you would like.  Might be helpful if you would like to configure the task on several machines at the same time.)
  • Right click on your ‘Task Scheduler Library’ and create a new task.
  • Name it.
  • Select how often you want it to run.
  • Select your recurrence.
  • Select ‘Start a program’.
  • In ‘Program/Script’ enter: “C:\Program Files\SyncToy 2.1\SyncToyCmd.exe”
  • In ‘Arguments’ enter ‘ -R ‘
  • Open the property box when you are done.
  • Select only run when logged on.
  • Close the properties window.

I selected only run while logged on because I am using this as a cloud repository.  If you would like to use the Synchronize option, it may make sense to run this even when the machine is not logged on.

So to perform a test of our new task:

  • Find your task in the scheduler window.  If you closed it, re-open it.
  • If you cannot find your task make sure to click the arrow next to ‘Task Scheduler’ and then click on ‘Task Scheduler Library’.  It should be in the window.
  • Right click and Run.
  • You should be able to tell if it worked successfully by watching the ‘ cmd ’ box that pops up.
  • After you verify, you should be all set.  Just keep an eye on it for a few days.

I like this to run every couple of hours.  If you would like to as well:

  • Right click on the task.
  • Select Properties.
  • In the triggers window select the Daily Trigger and click Edit.
  • Under the advanced section you will see ‘Repeat task every’.
  • Since we have a recurrence of the task running every day, make sure the ‘For a Duration of:’ is set to 1 day.  What this means is that the task will:
    • Start at a specific Date/Time.
    • The ‘Repeat Every’ will run the task once an hour for 1 day.
    • At which point the task will Start again, because we set it to recur every 1 day.
  •  Enter your preference and hit ‘Ok’.

 

Micah Norman