Search code examples
pythongoogle-drive-api

Backup files/folders on flash drive to Google Drive in Python


I am new to Python. I want to write a script that will backup all the files on a flash drive and upload them to Google Drive, retaining the file structure I have on the flash drive. How would I go about this in Python? I was looking at using something like pydrive to connect to Google Drive, but am unsure if there are better options.

As far as copying the files, I would like to ideally look through each folder and see if there are new files and just copy the new files rather than copy the whole directory each time (I have a lot of files).

I would appreciate any guidance on how to tackle this problem. Thanks!


Solution

  • Use rclone. One would normally do what you want directly from the command line, but there is a Python wrapper.