Sink
Sink is a CLI synchronisation tool that enables a user to synchronise local system files and folders with their Google Drives. It follows a git CLI like approach to facilitate straight-forward and easy synchronsiation. It uses the Google Drive API to interact with the Google Drive and OAuth to verify clients.
Installation
Install from zip file:
Download and extract the drive-sink-main
folder to a suitable directory and run the following commands in that folder. (It is advised to install in a virutal environment)
cd drive-sink-main
pip install .
Install by cloning:
Set up a new folder and then clone the repo into the folder.
git clone https://github.com/thakreyn/drive-sink.git
cd drive-sink-main
pip install .
After installation, run the command sink
from the environment to use the tool.
Script Setup
In case of a virtual environment, one might use the script inside scripts
folder by replacing the path inside the sink.bat
with the path of sink.exe
inside your env/scripts. And then add this script to your environment variables.
Assuming the path of env/scripts is : D:\Projects\trial\env\Scripts\sink.exe
@echo off
:: Replace the with the absolute path of your env/scripts folder
:startsink
D:\Projects\trial\env\Scripts\sink.exe %*
(NOTE: Above is applicable for windows only. Linux and Mac users need to create separate scripts)
Google Drive API Setup
As the application is based on the Google Drive API, in order to use it, you need to activate the Google Drive API for your account. Following are the steps to do so :
Enable Drive API for your account
After enabling the Drive API, you need to generate credentials for your account, the following article explains the steps to generate the credentials for your account.
Generate credentials for your account
After generating the credentials, download the .json
file with credentials and rename it to credentials.json
and paste it in the config folder 'after' initialising a directory.
Documentation
You can type in sink
in your terminal or sink --help
to see all the available commands available.
sink init
: Initialise the folder and config detailssink initdrive
: Verify credentials and sync files to drivesink scan
: Scans the directory for changes in files and folderssink sync
: Updates/commits the changes to the drivesink log
: Shows the commit logsink status
: Shows general config informationsink clean
: Cleans (untracks) the given folder with option to delete drive folder as well
For further options for each command, type sink
Usage Demo
- In order to initialise a directory for synchronisation, we need to use the command
sink init
- (optional) You can list the files to be ignored in the
ignore.txt inside
.sink` folder. For ignoring folders, just use an '!' before the name.
- Then we paste the
credentials.json
file generated by Google inside the config folder in .sink.
- Then run
sink initdrive
to verify your credentials and initialise the directory on your drive. - For just scanning the changes in the directory, we use
sink scan
- For syncing/commiting the changes to drive, we use the command
sink sync
. We can also the-m
option along withsink sync
to log a commit message. - To view commit messages, we can use the command
sink log
. Sink log can take in number of lines as an option (defalut = 5). sink status
can be used to see te config details for the current directory
License
Authors
- Yash Thakre : @thakreyn
Contributing
Contributions are always welcome! Your feedback will help me grow as a developer and help me build better and more usable apps.