prasmussen / gdrive

Google Drive CLI Client
MIT License
8.99k stars 1.19k forks source link

A Way to Delete ALL Files on Google Drive Main Directory #589

Open willjukebox opened 3 years ago

willjukebox commented 3 years ago

Hi there,

I'm trying to completely clean out my entire Google Drive. Trouble is there are some 100,000+ oprhaned files on my drive due to a mishandling of files. These files don't have any master folder or directory. I can only find them when I search "owner:me" on my drive. They do, however, show up on GDrive command line just fine. Is there any wat to recursively delete all files on my drive, even if they don't belong to a specific directory (just the overall one I guess)? What about deleting all files found within a query search? That would work as well. Thanks for any advice you have.

Cheers, Will Dziuk

Staceadam commented 3 years ago

Had a similar issue with a bad sync of a ton of node_modules. I ended up running gdrive list --no-header --max 0 | cut -d" " -f1 - | xargs -L 1 gdrive delete -r. It takes awhile to get the entire list and then again as it deletes each file but it worked.