CLI-based Google Drive Backup.
Terminal friendly gdrive
To easily backup your trained model, dataset, logs, etc. to your Google Drive using a simple CLI, you can follow these steps:
- First, download the gdrive CLI tool by running the following commands:
wget https://github.com/prasmussen/gdrive/releases/download/2.1.1/gdrive_2.1.1_linux_386.tar.gz tar -xvf gdrive_2.1.1_linux_386.tar.gz ./gdrive
- To make the
gdrive
command accessible from any directory, you can create a directory of your choice to store thegdrive
binary file, such as/home/sagar/bin/
. Then, add the path to this directory to your$PATH
environment variable in your~/.bashrc
file by running:mkdir /home/sagar/bin/ export PATH=$PATH:"/home/sagar/bin/" # enter this in your bashrc
- Now, copy the
gdrive
binary file to your chosen directory:cp gdrive /home/sagar/bin/
- To upload an entire directory recursively to your Google Drive, you can use the following command:
gdrive upload --parent <destination_id> --recursive <source_directory>
Replace
<destination_id>
with the ID of the destination folder in your Google Drive and<source_directory>
with the path to the directory you want to upload. E.g.https://drive.google.com/drive/u/1/folders/118mOZ771FOJiQMKRxX
this is indeded upload web-link of your google-drive, the destination id is118mOZ771FOJiQMKRxX
- To upload a single file to your Google Drive, you can use the following command:
gdrive upload --parent <destination_id> <source_file>
Replace
<destination_id>
with the ID of the destination folder in your Google Drive and<source_file>
with the path to the file you want to upload.
By following these steps, you can easily backup your files to your Google Drive using a simple CLI.
Reference
Github: prasmussen/gdrive
Enjoy Reading This Article?
Here are some more articles you might like to read next: