Tam Nguyen Photography

New York Beauty and Fashion Photographer

How I Use Google Drive to Back Up My Files

Posted on April 25, 2012 in Personal, Technology, Tips

How I Use Google Drive to Back Up My Files

UPDATE: the Google Drive apps are now available on the App store and GooglePlay. Some screen shots below.

If you’re a die-hard Google fanboy like me, then you should have already known that Google just released Drive, also previously known as Docs. If you’re not a Google fanboy, well, then it’s official: Google Drive is live. Google Drive is kind of like Dropbox and other online storage services, but it’s better, simply because it’s a Google product. Why? Everything I do is now integrated with Google across the board. What’s nice is that if your file format is supported by Google Docs Drive, you can open the file online without using Microsoft Office software or PDF reader.

While the service is new, the interface isn’t really different than what you used to see in Google Docs. The only huge difference is now you have a whopping 5 GBs of storage at your disposal. Dropbox wasn’t an option for me due to its initial limit of 2 GBs, and I didn’t want to spam my friends and family to get my box to increase its size. All of my most important documents rack up to about 2 GBs, including my Facebook archived data when I left it. Google Drive is the best solution for my personal data backup. I only wish the service had gone live sooner.

I spent a few minutes to create a batch file that gets run every Wednesday and Sunday at 11pm. All my important documents are mirrored into a location, which is synchronized with Google Drive. The batch file only works with Windows machine. If you have a Mac, well, I’m sorry that you’re stupid different.

@echo off
start "Google Drive Sync" "C:\Program Files (x86)\Google\Drive\googledrivesync.exe"
robocopy "D:\'B' Data\Documents" "D:\'B' Data\Google Drive\Documents" /S /MIR /R:3 /W:1 /LOG:"D:\'B' Data\mirror_drive.log" /NP
robocopy "D:\'B' Data\Work" "D:\'B' Data\Google Drive\Work" /S /MIR /R:3 /W:1 /LOG+:"D:\'B' Data\mirror_drive.log" /NP
IF %ERRORLEVEL% GTR 7 MSG * "Something went wrong with mirroring Google Drive. Check log!"

First, I tell the batch script to not display anything in the console by issuing the command

@echo off

Then, I start up the Google Drive desktop client. I have a 64-bit operating system, hence the (x64) part. Thanks to a small tip from a commenter, I’m able to start the client without having the console freeze (it did this with my previous version of the script).

Update: with Windows 7 and Task Scheduler, when you use the below command, the googledrivesync.exe process will be run under the user ‘System’, so unless your go and kill it, it’ll run in the background until you restart your computer.

start "Google Drive Sync" "C:\Program Files (x86)\Google\Drive\googledrivesync.exe"

Next, I issue a copy command from the source folder to the destination folder. The destination is what’s synchronized with Google Drive.

robocopy "D:\'B' Data\Documents" "D:\'B' Data\Google Drive\Local" * /S /MIR /R:3 /W:1 /LOG:"D:\'B' Data\mirror_drive.log" /NP

There are a few parameters to the command:
/S: copy all folders and subfolders
/MIR: mirror. If the source folders are removed, then remove the destination folders
/R:3: retry 3 times before giving up the mirroring
/W:1: wait for 1 second between each try
/LOG:file: specify where to log the copy command
/NP: No Progress – don’t display % copied in the log

I have a check at the end of the script. If anything goes wrong during the mirroring for some reason, I will be notified with a message box, telling me to look at the log.

IF %ERRORLEVEL% GTR 7 MSG * "Something went wrong with mirroring Google Drive. Check log!"

You can find more info about robocopy exit codes HERE.

One thing that I have beef with the Google Drive desktop client is that it doesn’t offer any command line option. I do want to run the mirroring and the synchronization at least twice a week, but I don’t want the client to run in the background. For now, I’ll just have to let it run for a few minutes before it finishes, and then I’ll kill the client. I hope Google’s working on updating the software.

Another major bug I’ve found with the client is that rather than checking the files for their hash values, I think Google Drive client checks for the timestamps, which is what robocopy already does. So, things could really get out of whack if, say, you remove a folder within your Google Drive local folder for robocopy to resync. Instead of resynchronizing, Google Drive client will make a new folder on the server, thus having 2 folders with the same exact content on Google Drive. Hello Google, have you guys heard of MD5 checksums?

That’s it. This is how I use Google Drive to backup my important files, and how I automate the process. If you have any questions or comments, feel free to drop a line below. You can head over to Google Operating System blog to read more on Google Drive.


  1. Jason April 29, 2012

    Thanks for the idea/script Tam.

    To launch the Google Drive client automatically use the ‘Start’ command, eg.:
    start “Google Drive Sync” “C:\Program Files (x86)\Google\Drive\googledrivesync.exe”.

    • Tam Nguyen April 29, 2012

      Thank you for the tip. I did think of that, but for some reason I was missing the “title” argument for my START command, so it wasn’t working right. Duh!

  2. Robert May 23, 2012

    saw your comments and I am interested to know if I can use Symantec Backup Exec to ftp my backup to the google drive ?



    • pabloto September 5, 2012

      I use Cobian Backup to copy my backup to local folder google drive. I needed to stop synchronizing and back in to keep the backup error but with this perfect!

    • Tam Nguyen August 19, 2012

      It’s just my way of naming my folders. I name them with the ‘A’ and ‘B’ and stuff so that they appear in the order I prefer.

  3. asma November 13, 2013

    how to pause data if we shutting down system in between?

  4. Karri October 9, 2015

    Ourselves and our oldest customers are appearing whereas
    start ups aren’t.

  5. Ashley December 2, 2015

    Get a carb table manual (view sidebar) to simply help learn and remember the
    carb counts of the meals being swallowed.

  6. dave August 2, 2016

    Dont use Robocopy /MIR
    … it removes new files that aren’t in the ‘source’ location.
    I wrote script like this to copy and backup pd documents,
    … then forgot and later used Google Docs (Online) to make new docs, and saved in the online documents folder. And also had Google-Drive-Windows (server) running, which downloaded my online docs to the Google-Drive-Folder on PC; all good so far.
    I forgot how my backup script worked and ran my backup script to copy from pc-documents-folder to pc-google-drive-documents-folder.
    … but fogot that script used robocopy /mir (which mirrors destination as source)
    … delected new documents in pc-google-drive-document-folder
    … which deleted docs on google-drive-documents online folder 🙂
    which I didn’t want to happen 🙁

  7. Rob February 16, 2017

    Does this preserve modification dates to Google Drive?

  8. bharath July 9, 2017

    can you please tell me how to change the source folder? i want all the data in the d folder to be backed up

  9. BestErnesto May 8, 2018

    I see you don’t monetize your site, don’t waste your traffic, you can earn extra cash every
    month because you’ve got hi quality content. If you want to
    know how to make extra bucks, search for: Ercannou’s essential adsense alternative


  1. [Windows] robocopyとGoogle Driveによる自動バックアップ - […] HOW I USE GOOGLE DRIVE TO BACK UP MY FILES […]

Leave a Reply

Your email address will not be published. Required fields are marked *