This repository provides a tool for uploading and downloading files to and from Google Drive. It uses personal credentials to access both individual and shared drives, allowing seamless transfer of folders and files.
pip install -r requirements.txt- Go to Google Cloud Console
- Create a new project
- Go to the project
- Go to the
APIs & Services-> enableGoogle Drive API - Go to the
Credentials-> create credentials ->Build on oAuth2.0->Desktop app - Download the credentials json and put it in the root of the project as
credentials.json
file_path="path/to/file"
folder_id="folder_id"
credentials_file="path/to/credentials.json"
ipython -- src/upload.py \
--file_path $file_path \
--folder_id $folder_id \
--credentials_file $credentials_filefolder="path/to/folder"
mother_folder_id="mother_folder_id"
# if you want to upload inside a existing folder, you need to give mother folder id
credentials_file="path/to/credentials.json"
ipython -- src/upload_folder.py \
--folder $folder \
--mother_folder_id $mother_folder_id \
--credentials_file $credentials_filefile_id="file_id"
dst_path="path/to/save"
credentials_file="path/to/credentials.json"
ipython -- src/download.py \
--file_id $file_id \
--dst_path $dst_path \
--credentials_file $credentials_filefolder_id="folder_id"
dst_folder="path/to/save"
credentials_file="path/to/credentials.json"
scan_size=1000
ipython -- src/download_folder.py \
--folder_id $folder_id \
--dst_folder $dst_folder \
--credentials_file $credentials_file \
--scan_size $scan_size