Skip to content

Python scripts for transferring files from an Android phone to Google Drive via PyDrive through Termux

Notifications You must be signed in to change notification settings

msekatchev/pydrive-android-file-transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

pydrive-android-file-transfer

Python scripts for transferring files from an Android phone to Google Drive via PyDrive through Termux

backup-pydrive.py uploads all of the files in local_folder_path to a folder titled drive_folder_title that it creates on the Google Drive home page. It also (optionally, if enabled) moves the uploaded files to a different folder on the phone specified via final_folder_title.

Setup

Termux

  • Download on Google Play Store.
  • Setup access to local phone storage by executing termux-setup-storage.

Python

  • Execute pkg install python.

PyDrive

  • Execute pip install pydrive.

Google Drive OAuth

  • Obtain a client_secrets.json file by following the instructions here.
  • Add your Google Account as a test user by following the instructions here.

Running backup-pydrive.py

  • Modify lines 5-8 of backup-pydrive.py appropriately:
local_folder_path = "/data/data/com.termux/files/home/storage/dcim/Camera" # folder from which to upload
drive_folder_title = "Camera" # new folder to upload to
relocate_uploaded_files = False # set to true if you want photos to be moved to a different location after upload
final_folder_title = "../camera-roll" # where photos are moved after being uploaded (if `relocate_uploaded_files` is True)
  • Place the backup-pydrive.py script and the client_secrets.json in a desired location on the phone.
  • Navigate to this location and execute python3 backup.py.

About

Python scripts for transferring files from an Android phone to Google Drive via PyDrive through Termux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages