Best way to upload a directory of images to Google

2019-04-15 11:41发布

I have a directory of images that I'd like to transfer to Google drive via a python script.

What's a good way to upload (recursively) a directory of images to Google drive while preserving the original directory structure? Would there be any benefit to making this multithreaded? And if so, how would that work?

1条回答
别忘想泡老子
2楼-- · 2019-04-15 12:09

I would do this in two passes. Start by scanning the folder hierarchy, and then recreate the folders on drive. Update your in-memory folder model with the Drive folder ids. Then scan your files, uploading each one with appropriate parent id.

Only make it multithreaded if each thread will have a unique client id. Otherwise you will end up triggering the rate limit bug in Drive. If you have a large number of files, buy the boxed set of Game Of Thrones.

查看更多
登录 后发表回答