--drive-trashed-only weird occurrence

So I was running the following command rclone delete “asusbkp:C Drive” --drive-trashed-only. Now, what I would’ve expected to happen was it would delete files that are in the trash only but it actually deleted files in the “C Drive” folder (sent them to trash). I remember having used this command to empty the trash on a team drive before. Is this supposed to work as I thought it would?

I forgot to add I’m using rclone 1.48 on windows 10. The remote is a google team drive.

rclone cleanup empties the trash.

So:

rclone cleanup remotename:

I remember reading somewhere that the cleanup command doesn’t work on Team Drives, something to do with the API. So that’s why I was trying that other command.

I use teamdrives, and I'm pretty sure I have used it sucessfully several times.

However, you need to be aware that this only send a signal to Gdrive to "do it eventually". Just because cleanup finishes really quickly doesn't mean the files are gone yet. Only that they will be removed with time. I believe Gdrive still basically has to go through and delete them one by one, which not only can take a long time but also is probably something they only prioritize doing when server-load is low.

It usually works pretty fast for me - seconds or minutes at worst. The documentation states something like "minutes or days" so it can probably vary wildly.

I tried the cleanup command last night and nothing has been deleted from the trash so I don't think that is working for team drives. But what is really worrying is that it seems that the --drive-trashed-only flag is not working properly. I ran the following test:

rclone version
rclone v1.48.0

  • os/arch: windows/amd64
  • go version: go1.12.3

rclone lsd "dateam:" --drive-trashed-only
-1 2017-08-25 16:28:07 -1 Documents
-1 2018-09-05 16:38:25 -1 Dropbox - DA
-1 2018-11-15 16:44:39 -1 From Clients
-1 2018-09-24 17:58:59 -1 Hardware Equipment
-1 2018-02-28 16:35:34 -1 Notes
-1 2018-02-28 16:35:03 -1 Shared
-1 2018-10-05 17:38:59 -1 Shared Folders
-1 2017-01-30 05:20:32 -1 Software
-1 2017-09-20 09:47:21 -1 Software Crestron
-1 2019-03-15 10:57:09 -1 Software Lutron
-1 2019-02-05 09:27:30 -1 Software VPN
-1 2019-02-19 13:27:46 -1 firmware
-1 2018-03-06 10:31:15 -1 xPanels

The dateam: remote is a google team drive. It's trash is empty and when I ran the command it just lists the regular folder structure.

Same behaviour happens here:

rclone lsd "pyteam:" --drive-trashed-only
-1 2017-01-30 16:11:12 -1 Archives
-1 2017-06-17 16:53:16 -1 Secure

pyteam: is a regular google drive remote and it's trash is not empty yet the command only shows the regular folders.

Can you share a picture of the trash and what you are expecting to see so we can see what's different.

Please see the attached screenshots:

Can you share the rclone.conf that goes along with it as well?

[dateam]
type = drive
client_id =
client_secret =
scope =
root_folder_id =
service_account_file =
token = {"access_token":"TOKEN GOES HERE","token_type":"Bearer","refresh_token":"TOKEN GOES HERE","expiry":"2019-07-31T11:00:16.5234298-04:00"}
team_drive = TEAMDRIVEIDGOESHERE

I will see if I can run a test to try and replicate the issue you are experiencing. Don't know if I will have the time today, but I'll tag this to remind me. I'm also on win10 and use google teamdrives so the setup should be basically identical (except I use the latest beta rather than stable 1.48).

It will list the regular folder structure, just not the regular files... Deleted files are held in their original directories and rclone can't find them without showing all the directories. You shouldn't see any non trashed files in the listing.

I just ran some more tests and you are right of course. I tested the rclone delete commands combined with the --drive-trashed-only and --drive-use-trash=false and it did delete only the trashed items. I think my confusion was due to me running the rclone purge command combined with the --drive-trashed-only for a folder and it actually deleting non trashed items as well. I then recovered the items from trash and ran the delete command with the flag and it ended deleting what I had just recovered. Probably because google was slowly moving them back from trash. I guess the --drive-trashed-only flag doesn't apply to the purge command?

I just had a look at the code.

You are right, purge will trash everything in the directory regardless of whether it is trashed or not. It says to google "trash this directory" in a single call.

So using --drive-trashed-only with Purge is likely not to work as the user expects! What I can do is make Purge exit with an error if it is called with --drive-trashed-only. Can you please make a new issue on github about this and I'll make the fix - thanks!

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