Skip to content

How to use gdrive.bash

rootorchild edited this page Dec 2, 2019 · 4 revisions

Run command gdrive.bash --help to show all options

thanh4@ubuntu1804:~$ gdrive.bash --help
gdrive.bash - Simple upload to Google Drive use curl

Usage: gdrive.bash [options] [command] [file ID]

Options:
  --about      show Google account informations
  --upload     upload to Google Drive
  --list       list directory and file
    all        list all directory and file
    dir        list directory only
    file       list file only
  --mkdir      create directory on Google Drive
  --delete     delete file or directory on Google Drive
  --info       show info of file
    name       show name only
    mimeType   show mimeType only
  --download   download file. Not download directory
  --help       show this help message and exit

Command gdrive.bash --about
Purpose show Google account informations
Result Email + Total + Used + Free
Example gdrive.bash --about
Email: backupxxxxxx@gmail.com
Total: 15.00 GB
Used : 7.05 KB
Free : 15.00 GB
Command gdrive.bash --upload [file or dir] [fileID]
Purpose Upload file or directory to Google Drive
If you want to upload to specific folder in Google Drive, add fileID of this folder at last.
Result Show upload processing
Example Upload to root directory:
gdrive.bash --upload bin
Creating directory bin...
Uploading file butgg.bash...
Uploading file cron_backup.bash...
Uploading file gdrive.bash...

Upload to directory with specific file ID:
gdrive.bash --upload butgg.bash 1ZhNqnaXBzjfmdFn0ps1r7S4pGCiNyMhg
Uploading file Uploading file...
Command gdrive.bash --list [command] [file ID]
Command all list all directory and file
dir list directory only
file list file only
Purpose List directory and file
Result OK Show list file (and/or) directory
Result Fail Show "Can not find file ID"
Example gdrive.bash --list all root
1ZhNqnaXBzjfmdFn0ps1r7S4pGCiNyMhg bin
1Rp0P9DNtx-mcJNLIUPp-7j4pwX3LKaOX .profile
1nkocDkP5m90VgV-GqZHFexaL3tCLsgYn butgg.log
1WaJR_5sT9GmE6lPm9IM-VX09J8UmmGGb 29_11_2019

gdrive.bash --list file 1ZhNqnaXBzjfmdFn0ps1r7S4pGCiNyMhg
1rJTjylcfEBuuDvEqHt9glNbiOIpOwlnL gdrive.bash
1-0lwBfk8_iARImZdyUuua_ZpsUCqaBJu cron_backup.bash
1gmcXAlBZhrg6YoEh8Rj9rOgdY_4lbjeL butgg.bash

gdrive.bash --list all 1111
Can not find file ID
Command gdrive.bash --mkdir [dir name] [file ID]
Purpose Create directory on Google Drive
If you want to create directory to specific folder in Google Drive, add fileID of this folder at last.
Result file ID of new directory
Result Fail Show "Can not find file ID"
Example gdrive.bash --mkdir butgg
1XLWvin8C5lL0HVJNHbSvdkJBQhHTLYI0

gdrive.bash --mkdir butgg 1XLWvin8C5lL0HVJNHbSvdkJBQhHTLYI0
1nsRiGRo8XiKO9J7QWZ-wZq0450oqWFmq

gdrive.bash --mkdir butgg 1111
Can not find file ID
Command gdrive.bash --delete [file ID]
Purpose Delete file or directory on Google Drive
Result OK Show "Deleted file ID [file ID]"
Result Fail Show "Can not find file ID"
Example gdrive.bash --delete 1XLWvin8C5lL0HVJNHbSvdkJBQhHTLYI0
Deleted file ID 1XLWvin8C5lL0HVJNHbSvdkJBQhHTLYI0

gdrive.bash --delete 1111
Can not find file ID
Command gdrive.bash --info [command] [file ID]
Command name show name only
mimeType show mimeType only
trashed show file or directory in trash or not
Purpose Show info of file or directory
Result OK Show name or mimeType or (false or true)
Result Fail Show "Can not find file ID"
Example gdrive.bash --info name 1WaJR_5sT9GmE6lPm9IM-VX09J8UmmGGb
29_11_2019

gdrive.bash --info mimeType 1111
Can not find file ID

gdrive.bash --info trashed 1PytnPTSxnxWRJ5P_93SkQGYvQTi4tiHk
false
Command gdrive.bash --download [file ID]
Purpose Download file. Not download directory
Result OK Show "Downloading file [file ID]"
Result Fail Show "Do not support download directory"
Example gdrive.bash --download 1Rp0P9DNtx-mcJNLIUPp-7j4pwX3LKaOX
Downloading file 1Rp0P9DNtx-mcJNLIUPp-7j4pwX3LKaOX...

gdrive.bash --download 1WaJR_5sT9GmE6lPm9IM-VX09J8UmmGGb
Do not support download directory

Clone this wiki locally