GSync - RSync for Google Drive
Copyright (C) 2013 Craig Phillips. All rights reserved.
Google currently don’t produce a Linux variant of their client for Google-Drive. This is my implementation of a multiplatform, command line tool that for the most part, is intended to behave much like rsync. I aim to follow the same functional implementation of rsync and also provide the same features, enabled or disabled through a similar interface of command line options.
There was a close contender for being a suitable client called grive. This is ideal if you only intend to sync a small library of files or if the files being synchronised are small in size. I found the client to be unreliable in other cases, crashing and failing to synchronise very little. I looked over much of the code and found that it favours preloading with a hash of the directory to be synchronised and all sub directories, before it even synchronises any files. This creates a scenario where synchronisation will never take place if the preloading fails. Instead, I will opt to process directories depth first and sequentially in order to allow synchronisation to occur immediately.
The only prerequisite is that you have python. The makefile will take care of installing any required python libraries using pip, which will also be obtained.
If you like the software, don’t forget to donate to further development of it!
The GSync package is now available on pypi.python.org. It can be installed using pip. I recommend using pip over easy_install or pypi-install, since pip takes care of dependencies through setuptools. I have found that easy_install only checks for dependencies but doesn’t actually install them. On Debian I installed using the following steps:
$ sudo apt-get install python-setuptools $ sudo easy_install pip $ sudo pip install gsync
To upgrade gsync, you can run pip with the –upgrade option:
$ sudo pip install –upgrade gsync
That’s it. GSync will be installed along with any required packages.
-v, --verbose enable verbose output –debug enable debug output -q, --quiet suppress non-error messages -c, --checksum skip based on checksum, not mod-time & size -r, --recursive recurse into directories -R, --relative use relative path names -u, --update skip files that are newer on the receiver -d, --dirs transfer directories without recursing -g, --group preserve group -o, --owner preserve owner (super-user only) -p, --perms preserve permissions -i, --itemize-changes output a change-summary for all updates –progress show progress during transfer
New in version 0.1.14:
- FEATURE #33: Option to change the default dir config files (.gsync and client.json).
New in version 0.1.13:
- FIXED BUG #32: MemoryError() with the checksum option with large files
New in version 0.1.10:
- FIXED BUG #31: Files being reported out of date when they are not.
- Added new filter module for future implementation of rsync filters.
New in version 0.1.9:
- Some improvements to README documentation.
- Better dependency specifications in setup.py.
New in version 0.1.8:
- FIXED BUG #26: Error: TypeError(‘a float is required’,)
- FIXED BUG #25: Transfer Stats
New in version 0.1.7:
- FIXED BUG #29: OSError(‘No such file or directory: h’)
New in version 0.1.6:
- FIXED BUG #27: Error: TypeError(‘a float is required’,)
- FIXED BUG #28: Command line arguments are not repeatable: e.g. –filter
New in version 0.1.5:
- FEATURE #12: Implement –checksum option.
- FIXED BUG #22: Modification time is not being set to match the source file modification time when used with –times
New in version 0.1.4:
- FIXED: setuptools used in place of distutils, meaning easier installation.
- FIXED BUG #19: Latin-1 file names are not supported and throw exceptions.
New in version 0.1.3:
- FIXED BUG #17 and #18: Does not obey –recursive option anymore.
- FIXED BUG #16: Error: __init__() takes at least 5 arguments (4 given)
New in version 0.1.2:
- FIXED BUG #15: Specifying source and/or destination files results in creation of directories where there should be files, on the client or server.
New in version 0.1.1:
- FIXED BUG #13: Specifying a file to copy instead of a directory does nothing.
- FIXED BUG #14: Attempted install on a ‘Python Fresh’ machine
New in version 0.1.0:
- Traversal of the Google drive is now more reliable and requires less CPU and network requests.
- Intermediate directory creation now occurs through a restructure of the directory walking code, ensuring directories are provided to the callback.
- Itemized output now occurs without needing to specify the verbose option.
- Interrupt handling now works, so Ctrl-C will halt the sync and output the progress (bytes sent/received) up to the interrupt.
- Implemented –progress functionality so that upload progress can be monitored.
- FIXED BUG: Syncs one file and crashes with division by zero error.
- FIXED BUG: Always: Error: String or Integer object expected for key, unicode found.
- FIXED BUG: Files get updated that are in Trash and do not get restored.