Cài đặt gdrive.sh
Để thực hiện tải các file từ google drive thông qua terminal, bình thường mình phải dùng lệnh curl trên từng link theo format API của google doc. Mình đã tìm được một script giúp giải quyết vấn đề này thông qua repo gdrive.sh
Install (Cài đặt)
Tải file ghrive.sh và tiến hành đặt alias lệnh:
curl https://raw.githubusercontent.com/GitHub30/gdrive.sh/master/gdrive.sh > /home/<user>/bin/gdrive.sh
alias gdrive.sh='curl gdrive.sh | bash -s'
Trên môi trường máy ảo hoặc server chạy:
mkdir -p ~/bin/
curl https://raw.githubusercontent.com/GitHub30/gdrive.sh/master/gdrive.sh > ~/bin/gdrive.sh
alias gdrive.sh='curl gdrive.sh | bash -s'
Uninstall (Gỡ bỏ)
unalias gdrive.sh
Hướng dẫn sử dụng
File support
Để tải 1 file về thì có thể chạy command sau:
curl gdrive.sh | bash -s < file id >
curl gdrive.sh | sh -s https://drive.google.com/open?id=<file id>
curl gdrive.sh | bash -s https://drive.google.com/open?id=<file id>
curl gdrive.sh | bash -s https://drive.google.com/file/d/<file id>/view?usp=sharing
curl gdrive.sh | bash -s https://drive.google.com/file/d/<file id>/view
curl gdrive.sh | bash -s https://drive.google.com/file/d/<file id>/edit
curl gdrive.sh | bash -s https://docs.google.com/file/d/<file id>/edit
Folder support
Để tải 1 folder chạy:
curl gdrive.sh | bash -s https://drive.google.com/drive/folders/<folder id>
curl gdrive.sh | bash -s https://drive.google.com/drive/folders/<folder id>?usp=sharing