Click here to Skip to main content
11,932,681 members (50,794 online)
Click here to Skip to main content
Add your own
alternative version


115 bookmarked

A Google Docs based backup applicaiton

, 21 Mar 2015 CPOL
Rate this:
Please Sign up or sign in to vote.
A C++ client for uploading documents to your Google Docs account.

Souce Code (updated)


I wanted to write a small application which allows dragging and dropping multiple files and folders into a container in order to send them to an online storage. This article was written before Google introduced Google Drive, but it is still practical to use it for quick upload of multiple files to your Google Drive. 

This article explains how to develop such an application that will use the free and the paid GoogleDocs service of storing documents and files online, allowing the end user to drag and drop files and entire folders and by doing so, backing up the selected files to a pre-defined GoogleDocs account.

Google Docs allows users to create and upload documents and files, work on them, and store them online. The service is free of charge; however, there are limitations which don’t exist when the paid service is used.

Google Docs Account Types

As described here, the free account type has its limitations when it comes to the types of files allowed to be uploaded. These limitations apply to the programmatic usage of the service, as opposed to using the online interface (

To lift some of the limitations, the end user should hold a Premier account. Users of the free account can only upload HTML, PDF, Word, Excel, PowerPoint, OpenOffice, text, and images.


As a base, we have developed a class library named SmartHTTP.

We have defined:

#define HTTP_POST_VERB                      L"POST"
#define HTTP_CONTENT_LENGTH                 L"Content-Length"
#define HTTP_CONTENT_TYPE                   L"Content-Type"
#define HTTP_MIME_BINARY                    L"application/octet-stream"
#define HTTP_MIME_FORM_URL_ENCODED          L"application/x-www-form-urlencoded"

Connecting to the GoogleDocs server is done by using:


and the call:

//... here we upload the documents, etc.

The Google Docs server is defined here:


You may need to open an account with Google. A GMail account will do. If you are logged in, just go to


Basically, my application is a container to which files and entire folders can be dragged and dropped, causing all files within them, including files inside subfolders, to be sent to the GoogleDocs server. When the application is started, the container appears.


Closing it will send it to the IconTray. The Icon application's Tray Icon is used to display status messages during runtime. For example, when a file is dragged to the container, it is being added to the queue, and the following message appears:


About the conversion to Google Docs format

Google Docs offers documents uploaded to be converted to Google Docs format. This conversion is explained here. From my experience, some types of documents may get corrupted as a result of such conversion, especially Word documents in right to left languages (Arabic, Hebrew, etc.).

For that reason, I have added a checkbox to allow the end user to decide whether to convert or not.

But before the first file can be copied, the Settings dialog pops up allowing the end user to enter the Google Docs account details. In addition, the following options can be set:

  • Google Apps Premier Account - allows indicating the type of the account.
  • List of Mirror Folders - allows adding (or deleting) local folders which will be mirrored at the server side keeping the structure of the files and folders under the given path.
  • Recreate Folder Structure in Google Docs - when this option is set, documents are copied to a folder with the same name as the local one.
  • Upload all Documents to the Root Google Docs folder - when this option is set, documents are copied to the root directory at the server side.
  • Start Program on Windows Startup - launches DocsOnline when Windows starts.


Premier account holders can copy more types of files which are restricted for regular (free) accounts.

The logic behind my intuitive backup

I believe applications and utilities should be intuitive and easy to use. For example, my application allows dragging and dropping folders, and by doing so, all files, and files within all subfolders, are backed up, after checking against previous copies already on the server. The logic I use for such "intuitive backup" is done using an examination of each file and a calculation of a hash which represents its contents. This logic addresses the following scenarios:

  1. Different files having the same name - copy, but automatically generate a new name. Add a log entry.
  2. Identical files having different names - add a log entry (in a later version, we shall unite such files in to a single one with a single name).
  3. Identical files having the same name - skip.


The SystemTraySDK class by Chris Maunder, used in my application, is a light wrapper around the Windows system tray stuff. It adds an icon to the system tray with the specified tooltip text and callback notification value, which is sent back to the parent window.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Michael N Haephrati (האפרתי)
CEO Secured Globe, Inc.
United States United States
Michael Haephrati, is an entrepreneur, inventor and a musician. Haephrati worked on many ventures starting from HarmonySoft, designing Rashumon, the first Graphical Multi-lingual word processor for Amiga computer. During 1995-1996 he worked as a Contractor with Apple at Cupertino. Worked at a research institute made the fist steps developing the credit scoring field in Israel. He founded Target Scoring and developed a credit scoring system named ThiS, based on geographical statistical data, participating VISA CAL, Isracard, Bank Leumi and Bank Discount (Target Scoring, being the VP Business Development of a large Israeli institute).

During 2000, he founded Target Eye, and developed the first remote PC surveillance and monitoring system, named Target Eye.

Other ventures included: Data Cleansing (as part of the DataTune system which was implemented in many organizations.

You may also be interested in...

Comments and Discussions

QuestionWhy not Google Drive? Pin
Marco Bertschi4-Feb-14 3:41
professionalMarco Bertschi4-Feb-14 3:41 
AnswerRe: Why not Google Drive? Pin
Michael Haephrati4-Feb-14 4:52
memberMichael Haephrati4-Feb-14 4:52 
GeneralRe: Why not Google Drive? Pin
Marco Bertschi4-Feb-14 4:58
professionalMarco Bertschi4-Feb-14 4:58 
QuestionUpload Error Pin
sid28819864-Oct-13 21:39
membersid28819864-Oct-13 21:39 
AnswerRe: Upload Error Pin
Michael Haephrati4-Oct-13 23:09
mvpMichael Haephrati4-Oct-13 23:09 
GeneralRe: Upload Error Pin
sid28819865-Oct-13 1:02
membersid28819865-Oct-13 1:02 
GeneralMy vote of 5 Pin
alonbarak14-Jun-13 11:56
groupalonbarak14-Jun-13 11:56 
QuestionGood Article Pin
SajeeshCheviry11-Mar-13 6:47
memberSajeeshCheviry11-Mar-13 6:47 
QuestionListing Pin
bothan7-Mar-13 21:49
memberbothan7-Mar-13 21:49 
AnswerRe: Listing Pin
Michael Haephrati7-Mar-13 23:02
mvpMichael Haephrati7-Mar-13 23:02 
Questionrequesting a report for this topic Pin
Member 984874422-Feb-13 7:16
memberMember 984874422-Feb-13 7:16 
AnswerRe: requesting a report for this topic Pin
Michael Haephrati22-Feb-13 7:19
mvpMichael Haephrati22-Feb-13 7:19 
GeneralRe: requesting a report for this topic Pin
phil.o21-Mar-15 2:08
professionalphil.o21-Mar-15 2:08 
GeneralMy vote of 5 Pin
Member 416352421-Feb-13 6:23
memberMember 416352421-Feb-13 6:23 
GeneralRe: My vote of 5 Pin
Michael Haephrati21-Feb-13 6:27
mvpMichael Haephrati21-Feb-13 6:27 
QuestionWhy was my message removed? Pin
Cristian Amarie17-Feb-13 21:56
memberCristian Amarie17-Feb-13 21:56 
AnswerMessage Removed Pin
Michael Haephrati מיכאל האפרתי17-Feb-13 22:06
mvpMichael Haephrati מיכאל האפרתי17-Feb-13 22:06 
GeneralMessage Removed Pin
Cristian Amarie18-Feb-13 0:44
memberCristian Amarie18-Feb-13 0:44 
GeneralRe: Why was my message removed? Pin
Michael Haephrati מיכאל האפרתי18-Feb-13 2:26
mvpMichael Haephrati מיכאל האפרתי18-Feb-13 2:26 
GeneralRe: Why was my message removed? Pin
yafan18-Feb-13 5:01
memberyafan18-Feb-13 5:01 
GeneralRe: Why was my message removed? Pin
Michael Haephrati מיכאל האפרתי18-Feb-13 5:03
mvpMichael Haephrati מיכאל האפרתי18-Feb-13 5:03 
GeneralRe: Why was my message removed? Pin
Michael Haephrati מיכאל האפרתי19-Feb-13 8:56
mvpMichael Haephrati מיכאל האפרתי19-Feb-13 8:56 
GeneralMy vote of 5 Pin
WebBHTAN16-Feb-13 5:59
memberWebBHTAN16-Feb-13 5:59 
GeneralMy vote of 5 Pin
liliflower35525-Jan-13 2:07
memberliliflower35525-Jan-13 2:07 
GeneralMy vote of 5 Pin
resi243125-Jan-13 1:06
memberresi243125-Jan-13 1:06 
GeneralMy vote of 5 Pin
midulm25-Jan-13 0:03
membermidulm25-Jan-13 0:03 
GeneralMy vote of 5 Pin
balam198824-Jan-13 23:17
groupbalam198824-Jan-13 23:17 
GeneralMy vote of 5 Pin
evan89724-Jan-13 22:36
groupevan89724-Jan-13 22:36 
GeneralMy vote of 5 Pin
Rutuanie24-Jan-13 20:34
memberRutuanie24-Jan-13 20:34 
GeneralMessage Automatically Removed Pin
23-Jan-13 23:17
memberPJohnMathews23-Jan-13 23:17 
GeneralMy vote of 1 Pin
PJohnMathews23-Jan-13 20:51
memberPJohnMathews23-Jan-13 20:51 
GeneralMy vote of 5 Pin
Good Writing15-Oct-12 23:44
memberGood Writing15-Oct-12 23:44 
GeneralMy vote of 5 Pin
Jason44413-Oct-12 22:43
memberJason44413-Oct-12 22:43 
GeneralMy vote of 5 Pin
johannafeldman1213-Oct-12 12:05
memberjohannafeldman1213-Oct-12 12:05 
GeneralMy vote of 5 Pin
George Rogers II13-Oct-12 7:36
memberGeorge Rogers II13-Oct-12 7:36 
GeneralMy vote of 5 Pin
Emma20123217-Sep-12 7:44
memberEmma20123217-Sep-12 7:44 
QuestionUpload Error Pin
.dan.g.7-Feb-12 18:06
member.dan.g.7-Feb-12 18:06 
AnswerRe: Upload Error Pin
Michael Haephrati8-Feb-12 7:36
memberMichael Haephrati8-Feb-12 7:36 
GeneralRe: Upload Error Pin
.dan.g.8-Feb-12 13:38
member.dan.g.8-Feb-12 13:38 
GeneralRe: Upload Error Pin
.dan.g.20-Feb-12 20:21
member.dan.g.20-Feb-12 20:21 
GeneralMy vote of 5 Pin
Jeff Kibling31-Jan-12 4:25
memberJeff Kibling31-Jan-12 4:25 
SuggestionImprovements Pin
Michael Haephrati27-Jan-12 9:41
memberMichael Haephrati27-Jan-12 9:41 
SuggestionRe: Improvements Pin
Herbisaurus8-Sep-13 3:40
memberHerbisaurus8-Sep-13 3:40 
GeneralRe: Improvements Pin
Michael Haephrati8-Sep-13 6:44
mvpMichael Haephrati8-Sep-13 6:44 
GeneralMy vote of 5 Pin
GregoryW25-Jan-12 21:56
memberGregoryW25-Jan-12 21:56 
GeneralMy vote of 5 Pin
Perfect.Beat.MC25-Jan-12 13:14
memberPerfect.Beat.MC25-Jan-12 13:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151126.1 | Last Updated 21 Mar 2015
Article Copyright 2012 by Michael N Haephrati (האפרתי)
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid