This repository contains scripts that make GDrive tasks easier using command line functions and PyDrive wrapper for Google Drive.
MIT License
This repository contains scripts that make GDrive tasks easier using command line functions and PyDrive wrapper for Google Drive.
GDrive_Sync aims at making life simpler when switching from Windows to Linux
This was developed with the aim to create a free and open source GDrive client to make things simpler and users won't need to switch to other cloud file storing platforms or have to pay for commercial clients doing the same.
GDrive_Sync asks for permission from your Google Drive account to carry out the essential operations as are mentioned later in the document.
GDrive_Sync uses PyDrive and crontab to interact with GDrive and Unix cron process manager respectively. It also requires root permission for the "-start", "-stop" and "-status" argument since it needs to alter the CronTab files.
futurize library is used for the purpose of making the code compatible with both, python 2 and python 3.
Current build works on Python 2 (Python 3 is supported but a bug is there which does not allow connection to be established on systems using proxy).
Please install pip before moving on if you don't have python-pip
sudo apt-get update
sudo apt-get install python-pip
Once pip is installed, download the below dependencies (you don't need to follow the below steps if using pip installation method).
pip2 install PyDrive
pip2 install python-crontab
pip2 install future
The repository can be installed through pip or by manually cloning the repository.
pip2 install drive_sync
crontab -e
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
LD_LIBRARY_PATH=/usr/local/lib
drive_sync -start
-config
parameter to add/modify upload or downloaddrive_sync -stop
./gdrive_sync/main.py -status
git clone https://github.com/thealphadollar/GDrive_Sync.git
./gdrive_sync/main.py -start
./gdrive_sync/main.py -start
to your cron jobs with periodicity of 5 minutes.-config
parameter to add/modify upload or download./gdrive_sync/main.py -stop
./gdrive_sync/main.py -status
The code for this is present in gdrive_sync/cron_handle.py
config_dicts/config.json
, then the file is deleted post upload to GDrive. Otherwise,config_dicts/config.json
then a share link for each uploaded file is placed in the set downloadGDrive_Sync requires Google Drive full read and write access.
It asks for "https://www.googleapis.com/auth/drive" which translates to, "Full, permissive scope to access all of a user's files, excluding the Application Data folder. Request this scope only when it is strictly necessary."
This is required in order to download and upload files as well as create directories along with creation of sharable link.
The author cannot modify/manipulate any personal data or Google Drive files. All the write/read access are provided solely to the user granting the permission.
The parameters that can be used are:
Reset account associated with GDrive_Sync and give it the read and write permissions to your Google Drive. Automatically executed at the first run of GDrive_Sync.
Start the automatic GDrive syncing of the folders set as upload directories.
Stop the automatic GDrive syncing of the folders set as upload directories.
Shows whether GDrive is uploading automatically or not.
Shows the current version of the GDrive_Sync.
Gives option to edit the configuration file on which automatic upload and download works.
Configuration is stored in config.json as a dictionary which can be manually edited as well.
Lists all files and folders in your GDrive (default or when "remote" used). Lists all files and folders in your downloads directory (when "local" used).
Lists all files and folders in your GDrive trash.
Lists files and folders in the given folder id in your drive.
Lists all files recursively present in the folder id given.
Downloads the given file from GDrive. Multiple files can be downloaded by putting file_ids one after the other. Use "-d all" argument to download entire your entire GDrive.
Upload file/folder corresponding to the address given to GDrive, for one time.
Outputs the shareable link of the file.
Delete the mentioned file from GDrive download directory or GDrive remote. Please input file_id/folder_id if it's a remote file. You can add multiple file_ids/folder_ids one after the other, e.g. -remove remote [file_id1] [file_id2]
Opens the upload or download directory in file explorer.
Contributions to this project are highly encouraged. We will soon be having a contribution guide. To begin, please have a look at the issues. They are simple and easy to implement/resolve.