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


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

Extracting Notes from Kindle using grep and Notepad++

Copy and paste notes from Kindle site into Notepad++

(Normal) Replace ‘Add a note’ with Null

(Normal) Replace ‘• Delete this highlight’ with Null

(RegEx) Replace ‘Read more at location .*’ with Null

(Normal) Find ‘Last annotated’ and cleanup around title.

Add ———————– after title to make finding it easy while scanning

(RegEx) Find ‘\n\r’ and replace with Null.

Micah Norman

Export your Twitter Followers to text and MSSQL Database

I would like a better Idea of who is joining and who is leaving my twitter feed.  The apps I have found are just short of horrendous.

Note: Thjs works for me based on the twitter feeds that I follow and follow me.  There is a holy grail expression that says all lines not starting with @, however I am having difficulty getting this to work in Notepad++.  Even after this, there are still about 5 lines I have to clean up.  This is a dirty way to do it, and hopefully Ill find a better way as I go.

In the meantime, until an app that actually works is released, below is the process I take to clean up the list.  I use notepad++ for this.  Note that the search functionality has three types, all that are used.  If you select the wrong type it will error out or give unexpected results.

This is something I am doing on the fly.  I may have typo’s or a not completely efficient system.  I do this at least once a week and will update this process as I go.

Note that items within the ‘ ‘ are the actual terms.  Do not include the ‘ in the actual field.

Note that when copying the terms from this page, do not inadvertently include the blank space prior to or after the ‘.  This will effect the results of RegEx expressions.

Copy paste follower list from into notepad++.  Make sure to get the entire list.

Notepad++ (RegEx) Find all in current document ‘@.*’ .  Select and copy all results to New tab

(RegEx) Find/replace ‘.*:’ with null
(Extended)  Find ‘ ? ‘ Replace with \n \t

(RegEx) Find ‘ .*[^\r][\n] ‘ Replace with Null

(RegEx) Find ‘ \t ‘ Replace with Null

(Normal) search ‘Protected account’ and ‘Verified Account’  replace with null

For some cleanup.

(RegEx) Find ‘ \n[^@]([A-Z][a-z].*) ‘ Replace with Null

(RegEx) Find ‘ \n\s[^@]([A-Z][a-z].*) ‘ Replace with Null.

(RegEx) Find all in current document ‘ @ *. ‘ and copy to new doc.

(RegEx) Find ‘  .*:  ‘ and replace with Null.

Manual Cleanup

If you are planning on putting this into a database by turning it into an Importable CSV, I reccomend running the following on the results which should simply be a list of all of your followers starting with potentially a space or two and then the @ symbol:

  • (RegEx) Find ‘ ^ .* @ ‘ replace with ‘ <Date Format of your choice>, @ ‘ For instance I put the following in the replace field, ‘ 5-15-2013, @ ‘.

After running through this process you should have a clean import file.  Take a quick look through the file just to be certain.

Once I have verified it is clean I use Microsoft SQL Import utility to do a quick import of my csv file into a database.  I created a database named ‘Social’ with a table named ‘Twitter’.  The table has only two fields at the moment.

  • Date – datetime
  • User – varchar[50]

You can let the import utility create your table for you the first time you run it.  After selecting the imput file, be certain to change the name of the fields and the type of field under the advanced section.  The User field time is fine with the default.  Be sure though to change the Date field from the default varchar to Date.

After configureing the input, be sure to name your table.

All subsequent times you run this, be sure to name your fields in a consistent manner and select the correct variable type.  When you get to the table selection field it will default to creating a new table.  Be certain to click on the table name and select the table you created in the first import.  By default, when you select an existing table, it should change the import type to append.  It doesn’t hurt to hit the ‘Edit Mappings’ button on this just to be certain.

So far, just because I wanted to see who left me, I wrote a quick and dirty query.  Ill create a more advanced view with appropriate parameters in an upcoming session.  For the time being, this is the query I use to see:

  • Who I lost

use <databasename>

select *
from Followers
where Date = ‘2013-05-13’
and [User] not in (select [user] from followers where Date = ‘2013-05-15’)

  • Who I gained

use <databasename>

select * 
from Followers
where Date = ‘2013-05-15’
and [User] not in (select [user] from followers where Date = ‘2013-05-13’)

The above queries allow you to compare Date 1 with Date 2.  This should be used only if you have two single dates to compare.  If like me, you want to know who left or who gained over a time period, these queries will help.

  • Who I lost

use <databasename>

select distinct([User])
from Followers
where Date between ‘2013-05-13’ and ‘2013-05-15’
and [User] not in (select [user] from followers where Date = ‘2013-05-16’)

  • Who I gained

use <databasename>

select distinct([User])
from Followers
where Date = ‘2013-05-16’
and [User] not in (select [user] from followers where Date between ‘2013-05-13’ and ‘2013-05-15’)

Basically the first query says, “Make a list of all unique items which have an associated date from date1 to date2.  Then make another list of users with a date from date2(+1 day).  Then show me a list of all users from the first list who do not have a corresponding entry in the second list.”  More simply, “If an entry exists in the between dates, but does not exist in the current date, then the follower has left.”

(If I can figure out the Not Operator in Notepad++, this should cover everything I am looking to do in one step .*[@].*  Ill look at this next time I do this.)


Micah Norman

%d bloggers like this: