DriveSync is a command-line utility that synchronizes the local files in your computer with Google Drive. It provides a simple and efficient method to keep your files organized and backup them to be accessed remotely.
- Download remote files
- Upload local files to Google Drive
- Delete or update files both locally and on Drive
- Able to Ignore selected files
- Able set file size thresholds
- Automate using cron job
First of all, you need to have Ruby 2.x installed. The software is officially tested and developed with 2.3.0 and 2.1.2.
You can check the installed version by typing:
$ ruby -v
1. Install Ruby
If you don't have Ruby installed, just install it:
$ sudo apt-get install ruby ruby-bundler
$ sudo pacman -S ruby ruby-bundler
$ sudo dnf install ruby rubygem-bundler
2. Install DriveSync
Now it's the same in every distribution, execute this lines (separately):
$ git clone email@example.com:MStadlmeier/drivesync.git $ cd drivesync $ bundle install
And that's it! You can now run DriveSync by typing:
$ ruby drivesync.rb
How to use
When you run the program, it'll give you a URL, like this one (I've hidden the id for security reasons):
Then, paste the URL in your browser and you'll get the authorization code. Copy that code and paste it in your open terminal as it is. Then press Enter:
Now, DriveSync will start to synchronize your computer with Google Drive, so it may take some time.
All the software settings are located in a config.yml file. It's located in pathToDrivesync/config.yml. For example, as I have DriveSync installed on /home directory, the path should be: drivesync/config.yml
That config file has all the settings explained. As the official documentation says, the most important configuration at the beginning is the location for the drive folder in your local system. You can set it as you like.
It'd be better to synchronize your files automatically than doing it manually by adding to cron job. This is possible by following these steps:
Type in a terminal:
$ crontab -e
You'll be asked what text editor do you want to use. Choose the one that you prefer, in this case I chose nano.
Then paste this line:
*/1 * * * * ruby /pathToDrivesync/drivesync.rb
It should be something like this:
Save the file and close.
The developer doesn't advise syncing large files. DriveSync ignores by default any file above 512MB. This can be changed in the config file, and you may have to change the timeout threshold too (in the same file).
Google Drive allows files or folders with identical paths, while Linux doesn't. So try not to have identical paths. Also, DriveSync ignores Google Docs files, but there may be a fix in the future. You can go to the official repository and read more documentation.