Is it possible to permanently delete files from Google Drive after they've been trashed more than X days?

I want to permanently delete all files and folders from Google Drive that have been in the trash longer than X days.

This is not possible with the cleanup command because it completely empties the trash.

Rclone has the --drive-trashed-only flag to only work with files that are in the trash and I guess that can be combined with the --drive-use-trash=false while using the delete command but how do I find all files and folders that have been in the trash longer than X days? The flag --min-age can't be used for that so maybe we need a new flag called --min-trash-age or something. Or is there another way to achieve this?

The min/max age is working for me. What is your command?

I don't want to delete files based on their age but based on the time they've been in the trash. I hope that distinction is clear.

For example: I want to permanently delete all files that have been in the trash longer than 30 days. Assume I deleted a 2 year old file yesterday, I want to keep it there for another 29 days before it gets deleted.

Of course for this to be possible rclone should be aware of the trash timestamp of files and folders, is it?

1 Like

Yes! I see now. I dont see that data in the API though. Maybe i'm missing it.

1 Like
I see trashedTime as part of files metadata. Can rclone use that?

Nice catch. I did miss it. If the data is there, then its surely possible. If @ncw agrees then first step would be to make a issue on git.

And if you'd like to contribute code to add it to rclone then that would be even better.

Although I do see this:

" The time that the item was trashed (RFC 3339 date-time). Only populated for items in shared drives."

And I missed that, oh well, that's too bad. :frowning:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.