Power User Google Syncing with Syncdocs
We’re often asked how to automate tasks with Syncdocs. Using the command line with Syncdocs, you get more control over your Google Docs account.
- create a batch file to backup for a specific user
- call Syncdocs from another program to upload a file or folder
- share a folder with others
- view a local file in Google Docs viewer
- control Google Docs via a script
- automate deployment
Syncdocs is controlled via the command line with these options:
Command line options
Automatic Deployment and Account pre-configuration
For administrators who want to deploy and pre-configure Google Drive to their users, there’s an automated deployment guide. This describes command line options useful for deployment like:
-syncfolder -oauth -user -password -iacceptterms
Run once only
If you wish to run Syncdocs only once, for backup purposes, say once a day, you can add an item to the Windows scheduler.
The Syncdocs command line option to run once is –OnlyRunSyncOnce
This option is not case sensitive.
Standard shell error reporting is supported, exit code 0 means no problems, 1 a serious error.
Specifying another user
You can specify another user for Syncdocs with the –u or –user option.
The syntax is:
syncdocs.exe –u email@example.com
This will start Syncdocs with this user’s Syncdocs credentials and settings, the same as switching users in the Preferences menu.
If the user specified does not exist, then Syncdocs will ask the user for their details. If Syncdocs is already running, accounts will not be switched.
This can be useful for deployment.
If you use multiple accounts, you can create desktop shortcuts for each account using this command line.
Live command line options
The options below work fastest when Syncdocs is already running and synced. If Syncdocs is not running, it will take a few (5-60) seconds to log in first, before processing your command.
Creating new files
To create a new document on Google Docs:
syncdocs.exe create doc
In general the syntax is:
syncdocs.exe create [doc|sheet|presentation|email|calendar]
to create the new type you wish in a web browser on Google Docs.
Uploading existing files
To upload an existing file (of any type) from your PC to Google Docs:
syncdocs.exe upload “C:\path\filename.ext”
If exactly the same file (based on contents, file name and time) is already on Google Docs, then the file is not uploaded again. If the file is uploaded, it is uploaded to the “Direct Uploads” collection on Google.
To view a file
Similar to uploading a file, to view a file in Google Docs using the default web browser:
syncdocs.exe view “C:\path\filename.ext”
Google supports viewing:
- Office 2007/2010 .docx, .xlsx, pptx
- Office 95-2003 .doc, xls, ppt, pps
- Open/Libre Office/Open Document Format .odt, ods
- Apple pages.
- .pdf, .xps
- most image formats: .jpg, .bmp, .png
- vector images: .ai, .dxf, .svg
- postscript: .ps, .eps
- fonts: .ttf
- archives: .zip, .rar
see here for a full list
If exactly the same file is already on Google Docs, then the online version is used. If the file is uploaded, it is uploaded to the “Direct Uploads” collection on Google.
To open a file for editing
Similar to viewing a file, you can open a file for editing, if the file format can be edited and your current settings allow conversion to Google Docs.
syncdocs.exe open “C:\path\filename.docx”
Only formats supported for editing will be opened (most MS Office and Open files and text files, see Conversion section of FAQ for more).
If the file cannot be opened, it will be opened for viewing.
Similar to uploading a file, to share a file in Google Docs
syncdocs.exe share “C:\path\filename.ext”
If exactly the same file is already on Google Docs, then the online version is used. If the file is uploaded, it is uploaded to the “Public Share” or “Direct Uploads” collection on Google, depending on whether it is shared publically, or just to specific users and groups.
You can share entire folder trees in the same way:
syncdocs.exe share “C:\path\folder\”
Note the trailing slash “folder\”. Syncdocs will upload the whole folder tree on the next sync, if it is not already on Google.