How to sync your GoogleDrive storage on Linux with Rclone
And some tips to integrate it on XFCE4
Google Drive is definitely a great cloud storage service.
However, it suffers from significant limitations, including the lack of an official sync client for Linux.
Fortunately there are many tools that allow you to access Google Drive with Linux, but no one provides a user experience similar to the Windows/OSX client.
So, for my Debian laptop, i have realized some scripts to synchronize my GoogleDrive documents using RClone.
Rclone is a command line program to sync files and directories to and from a lot of cloud storages:
- Google Drive
- Amazon S3
- Openstack Swift / Rackspace cloud files / Memset Memstore
- Google Cloud Storage
- Amazon Drive
- Microsoft One Drive
- Backblaze B2
- Yandex Disk
- The local filesystem
Rclone is extremely powerful, however the ‘sync’ option is not bidirectional, so some workarounds are needed to get an acceptable user experience.
For information about rclone installation you can refer to the official guide:
and here a simple guide to configure GoogleDrive:
Once installed Rclone and proper configured the Google Drive account let’s start to make a couple of scripts to realize an experience similar to git , with the ability to perform ‘push’ and ‘pull’ operations from cloud storage.
The scripts can be saved in a hidden directory in your home (such as ~/.scripts/): if you run one of this script into a specific directory inside the folder ‘Documents’, it performs a synchronization to the cloud storage (push) or from the remote storage to the local disk (pull).
Integrate the scripts with XFCE4 Thunar
On my laptop, i use XFCE4 as desktop manager. The default file manager (thunar) has a useful feature: the Custom Actions
Thunar allows users to add custom actions to the file and folder context menus (by the use of the
thunar-ucaplugin, part of the Thunar distribution, in the
plugins/subdirectory). You can set up new actions in the Custom Actions dialog, available via the Configure custom actions… item in the Edit menu.
So, i have realized two custom action in order to perform push and pull operation directly from the graphical interface.
Simply create one custom action named ‘GoogleDrive Pull’ with this command line:
xterm -hold -e ~/.scripts/googledrive_pull.sh
and another named ‘GoogleDrive Push’ with this command:
xterm -hold -e ~/.scripts/googledrive_push.sh
In this way, by performing the click with the right button in a directory within the ‘Documents’ folder, you can download the updated version of the same from Google Drive or upload to the cloud the local changes: