iterative / PyDrive2

Google Drive API Python wrapper library. Maintained fork of PyDrive.
https://docs.iterative.ai/PyDrive2
Other
581 stars 69 forks source link

How to update/change folder name, keeping its content intact? #190

Closed meet1919 closed 2 years ago

meet1919 commented 2 years ago

I have an app where some values are linked to the folder in google drive. The folder name is the same as the value (str), when changing the value, the change should also be reflected in google drive (in terms of change in the folder name). I can't find how to do that in the documents other than updating file metadata. Can my problem be solved with updating file metadata?

meet1919 commented 2 years ago

This works

# CreateFile() can be called with an existing id.

folder1 = drive.CreateFile({'id': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'})
old_title = folder1['title']
folder1['title'] = '<new title>' # Change title.
folder1.Upload()