Google drive trashed_only in config file not showing trash

What is the problem you are having with rclone?

On a google drive remote, when using --drive-trashed-only via CLI, I have the expected output with only trashed content. When placing trashed_only = true into the config file, trashed files are not shown, only the regular non-trashed contents are shown.

Run the command 'rclone version' and share the full output of the command.

root@debian:~/.config/rclone# rclone --version
rclone v1.62.2
- os/version: debian 11.6 (64 bit)
- os/kernel: 6.1.0-7-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.2
- go/linking: static
- go/tags: none

Are you on the latest version of rclone? You can validate by checking the version listed here: Rclone downloads
-->
Yes; I ran rclone selfupdate and was updated to the above version. Same result

Which cloud storage system are you using? (eg Google Drive)

Google drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone ls trash:

The rclone config contents with secrets removed.

[gsuite]
type = drive
client_id = redacted
client_secret = redacted
scope = drive
token = redacted
team_drive =

[gcrypt]
type = crypt
remote = gsuite:crypt
password = redacted
password2 = redacted

[trash]
type = crypt
remote = gsuite:crypt
password = redacted
password2 = redacted
trashed_only = true

A log from the command with the -vv flag

root@debian:~/.config/rclone# rclone ls trash: -vv
2023/04/16 18:23:15 DEBUG : rclone: Version "v1.62.2" starting with parameters ["rclone" "ls" "trash:" "-vv"]
2023/04/16 18:23:15 DEBUG : Creating backend with remote "trash:"
2023/04/16 18:23:15 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2023/04/16 18:23:15 DEBUG : Creating backend with remote "gsuite:crypt"
2023/04/16 18:23:15 DEBUG : Google drive root 'crypt': 'root_folder_id = redacted - save this in the config to speed up startup
8696799232 file1
8284929153 file2
...
...
...

The above are all files that are NOT deleted (not the expected output, as the trash remote has the trashed_only option. If I instead run the command

root@debian:~/.config/rclone# rclone ls gcrypt: --drive-trashed-only -vv
2023/04/16 18:53:18 DEBUG : rclone: Version "v1.62.2" starting with parameters ["rclone" "ls" "gcrypt:" "--drive-trashed-only" "-vv"]
2023/04/16 18:53:18 DEBUG : Creating backend with remote "gcrypt:"
2023/04/16 18:53:18 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2023/04/16 18:53:18 DEBUG : Creating backend with remote "gsuite:crypt"
2023/04/16 18:53:18 DEBUG : gsuite: detected overridden config - adding "{txBp-}" suffix to name
2023/04/16 18:53:19 DEBUG : Google drive root 'crypt': 'root_folder_id = redacted - save this in the config to speed up startup
2023/04/16 18:53:19 DEBUG : fs cache: renaming cache item "gsuite:crypt" to be canonical "gsuite{txBp-}:crypt"
2023/04/16 18:53:20 DEBUG : Google drive root 'crypt': Disabling ListR to work around bug in drive as multi listing (5) returned no entries
2023/04/16 18:53:20 DEBUG : Google drive root 'crypt': Recycled 5 entries
2023/04/16 18:53:20 DEBUG : Google drive root 'crypt': Re-enabling ListR as previous detection was in error
2023/04/16 18:53:21 DEBUG : Google drive root 'crypt': Disabling ListR to work around bug in drive as multi listing (50) returned no entries
2023/04/16 18:53:21 DEBUG : Google drive root 'crypt': Recycled 50 entries
2023/04/16 18:53:21 DEBUG : Google drive root 'crypt': Recycled 50 entries
9879384859 deletedfile1
2023/04/16 18:53:25 DEBUG : pacer: Reducing sleep to 25.722014ms
2023/04/16 18:53:25 DEBUG : pacer: Reducing sleep to 60.81426ms
2023/04/16 18:53:25 DEBUG : pacer: Reducing sleep to 159.369229ms
2023/04/16 18:53:25 DEBUG : pacer: Reducing sleep to 245.861389ms
...
...
...

2023/04/16 18:54:48 DEBUG : pacer: Reducing sleep to 187.139253ms
278016125 deletedfile2
269075006 deletedfile3
...

All of the files are trash files as expected. Since the CLI flag works but not the config file option, it must be something wrong with trashed_only = true? I attempted other variations such as trashed_only = "true" however this did not work.

Any insight into my misstep would be appreciated.

CC

Hi CacklingCapybara,

You almost got it right, the trick is to use trashed_only on the underlying drive remote (not the crypt remote). This is what happens when you successfully use --drive-trashed-only.

So you could do something like this (note the last line in gtrash and the remote of the crypt):

[gtrash]
type = drive
client_id = redacted
client_secret = redacted
scope = drive
token = redacted
team_drive =
trashed_only = true

[gtrashcrypt]
type = crypt
remote = gtrash:crypt
password = redacted
password2 = redacted

or use the more advanced connection strings like this (this is my personal favorite due to flexibility and ease of troubleshooting):

[gtrash]
type = alias
remote = gsuite,trashed_only:

[gtrashcrypt]
type = crypt
remote = gtrash:crypt
password = redacted
password2 = redacted

or make it in a single (more complex) step like this:

[gtrashcrypt]
type = crypt
remote = gsuite,trashed_only:crypt
password = redacted
password2 = redacted

Note: gsuite,trashed_only: is just a shorthand for gsuite,trashed_only=true:

You can find more details here:
https://rclone.org/docs/#connection-strings
https://rclone.org/alias/

I hope this makes sense and works for you, otherwise please ask.

2 Likes

Thank you, this worked. I didn't read anywhere that trashed_only = true could not be used on a crypt remote. You get a gold star!

1 Like

Thanks a lot, happy to hear!

No problem, and even if you knew it still takes in-depth rclone knowledge/experience to see the possibility/usage of connection strings in the remote of an alias, crypt, etc. You may have noted the hints I inserted in the docs linked above when I discovered the possibility myself late last year.

Here is the list I often use to find flags:
https://rclone.org/flags/

Note the section with Non Backend Flags (can be used on all backends, but not necessarily all commands):
https://rclone.org/flags/#non-backend-flags

The non backend flags are documented here:
https://rclone.org/docs/

Also note the section with Backend Specific Flags (can only be used on the respective backend, e.g. --drive-trashed-only):
https://rclone.org/flags/#backend-flags

The backend specific flags are documented under the respective backend, e.g.:
https://rclone.org/drive/#drive-team-drive
https://rclone.org/drive/#drive-trashed-only
https://rclone.org/crypt/#crypt-remote
https://rclone.org/crypt/#crypt-filename-encryption

Here you can e.g. see that the command line flag --drive-trashed-only also can be set as trashed_only in the config of a drive remote or as the environment variable RCLONE_DRIVE_TRASHED_ONLY.

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