It's a command-line tool let you easily upload and download files.
-
Upload :
- Upload into a newly-created directory
- Upload into an existing directory
- Upload into a newly-created directory in an existing directory
-
Download :
- Download files or directories into a designated local path
-
List :
- Display metadata of files under a designated directory and stored info into
list.json
- Display metadata of files under a designated directory and stored info into
- Python 3 or above
- pip or pip3 is installed
Visit Google Developers Console and apply for the credentials.
After set up successfully, choose option to download it as JSON format and save it into your local space.
( You can follow this direction : 建立憑證 )
Please install with the command :
$ pip install -r requirements.txt
You can follow this direction : 使用手冊 or read the following simple instructions :
Typical structure :
$ python -m gdrivetool [function] {[arg1] [arg2]...}
For the first time, please authenticate gdrive API and a new file named token.pickle
will automatically be created with the following command.
$ python -m gdrivetool auth -cred '{/path/to/yourcredentials.json}'
-
Introduction to arguments :
-
auth
: choose authenticate functionOptions :
-cred
(Required): personal OAuth 2.0 credential file with format of JSON
-
( If you want to change different account to download or uplaod, just execute above command again. )
$ python -m gdrivetool upload '{Options}'
-
Introduction to arguments :
-
upload
: choose upload functionOptions :
-src
(Required) : full path or relative path to source file or directory to upload-new
(Optional) : new folder name you wanna create into gdrive-dest
(Optional) : destination directory id/url in gdrive where you wanna upload into
( Input more than one path at one time is permitted and remember to separate different path by "whitespace" )
For example :
$ python -m gdrivetool upload -src '{/path/to/file}' '{/path/to/folder}' -new '{foldername}' -dest '{directoryid/url}'
-
$ python -m gdrivetool download '{Options}'
-
Introduction to arguments :
-
download
: choose download functionOptions :
-src
(Required) : multiple gdrive ids/urls-dest
(Required) : path/to/local/directory as download destination-c
(Optional) : Update all files and folders with the same name without more request
( Allowed to add more than one id or url at one time and remember to separate different ones by "whiteapce" )
For example :
$ python -m gdrivetool download -src '{fileid}' '{directoryurl}'... -dest '{/path/to/localdirectory}' -c
-
$ python -m gdrivetool list -src '{gdrive folder url/id}'
-
Introduction to arguments :
-
list
: choose list functionOptions :
-src
(Required) : directory id/url ( input one at one time )
-
- If you execute on
zsh
with urls, to quote your url will be necessary.