Just wanted to share my experience with emptying my google drive trash. Google's UI method to emptying trash is awful and extremely lacking, especially for the kind of people who use rclone.
The cleanup
command was implemented into rclone to help. It basically uses the drive DELETE
api command, which can be demoed here: https://developers.google.com/drive/api/v2/reference/files/emptyTrash?apix=true#try-it
I used the command, and it kinda worked, but even Nick (rclone's developer) has commented on other posts on this forum about how no-one really knows what's going on or why it sometimes doesn't work. For example, I tried the DELETE command directly in google's developer portal (link above) and the trash did not empty. Same with the the cleanup
command. It's not the fault of rclone, it's Google's bad implementation of a simple delete idea.
But, I did find a solution that worked for me (be careful, however, as you can use a lot of API requests and get rate limited.) Use your own secret/key and I would recommend using a separate secret/key/project from the one you use for your production rclone setup.
Here's the command to run (add --dry-run
to the first run to verify everything first so you know what you're deleting)
rclone delete gdrive-root: --drive-trashed-only --drive-use-trash=false --verbose=2 --fast-list
gdrive-root
: a custom remote that has it's own client/key and does not have a folder id (runs on the root of the google drive)
--drive-trashed-only
: This is absolutely crucial. It interacts with only the files in the trash in the same folder structure as it was when it was deleted from the drive.
--drive-use-trash=false
: Also critical, as it doesn't use the drive trash when you delete the files. By default, a google drive remote will send deleted files to the google drive trash. We obviously want to empty the trash, so the false flag will bypass this default option.
--fast-list
: this build a list of the files in memory. It uses less transactions (good for API usage) but it uses a little more memory.
--verbose=2
: prints a verbose output of the operation, useful for keeping a visual eye on the progress
After running this, I empty 3tb of data that was just junk. I hope this helps someone who needs to empty their trash.