Skip to content

thakreyn/drive-sink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Sink-main

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 <path> 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 details
  • sink initdrive : Verify credentials and sync files to drive
  • sink scan : Scans the directory for changes in files and folders
  • sink sync : Updates/commits the changes to the drive
  • sink log : Shows the commit log
  • sink status : Shows general config information
  • sink clean : Cleans (untracks) the given folder with option to delete drive folder as well

For further options for each command, type sink <command-name> --help

Usage Demo

  1. In order to initialise a directory for synchronisation, we need to use the command sink init Sink init2
  2. (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.
    Sink ignore
  3. Then we paste the credentials.json file generated by Google inside the config folder in .sink.
    Sink Cred
  4. Then run sink initdrive to verify your credentials and initialise the directory on your drive. sink initdrive
  5. For just scanning the changes in the directory, we use sink scan Sink scan
  6. For syncing/commiting the changes to drive, we use the command sink sync. We can also the -m option along with sink sync to log a commit message. Sink sync
  7. 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 log
  8. sink status can be used to see te config details for the current directory Sink status

License

MIT

Authors

Contributing

Contributions are always welcome! Your feedback will help me grow as a developer and help me build better and more usable apps.

About

Sink is a CLI tool that allows users to synchronize their local folders to their Google Drives. It is similar to the Git CLI and allows fast and reliable syncs with the drive.

Resources

Stars

Watchers

Forks

Packages

No packages published