Just a little script to help me for downloading files via gdrive without interrupted by Google API error.
I used to have an ASUS's free quota for Google drive. But today, the quota was expired. I have to immediately ~~~evacuate~~~ copy files to the another Google drive account. But :
- Google doesn't provide an easy option for copying the whole drive to another account.
- My dormitory's internet is suck! I can't make it done easily. :(
- I have a cloud server with very fast internet connection. But I can use via SSH only.
GDrive
CLI has no option for skip downloaded file.
So, I have to write this scripts in the middle of the night.
- Download and install
gdrive
. Don't forget to allow access by run
gdrive list` and follow the instruction. - Get
folderID
from your drive. The easiest way is browse the folder in the browser. You'll see URL like this:https://drive.google.com/drive/u/0/folders/<folderID>
. - Prepare folder in your local computer and get an absolute folder path.
- Fill
<folderID>
inist_folders("<folderID>")
(line 23) ingdrive_list_all.py
without angle brackets. - Fill
<rootFolder without tail slash>
inrootFolder = '<rootFolder without tail slash>'
(line 4) ingdrive_download_check.py
without angle brackets. - Run :
python gdrive_list_all.py
python gdrive_download_check.py
gdrive_list_all.py
will generate arrays of fileID and file path intodata.json
gdrive_download_check.py
will readdata.json
, check whether file is existed. If not, it'll download files from your Google drive