Reputation: 23
Is there any way to only list the trashed files? For my current project, I just need to know if the trash bin empty or not.
note: I'm using python 3 and drive API v2 with PyDrive
Thanks for your attention.Hope you will try to help me.
Upvotes: 0
Views: 902
Reputation: 201378
I believe your goal as follows.
In this case, how about using ListFile
method with the search query of trashed=true
? By this, when the returned value has the values, it indicates that the trashed files are existing. When this is reflected to a sample script, it becomes as follows.
drive = GoogleDrive(auth) # Please use your "auth".
res = drive.ListFile({'q': "trashed=true"}).GetList()
if not res:
print("No trashed files.")
else:
print("Trashed files are found.")
Upvotes: 1