Web GUI + rmdirs picking up nonempty folder

What is the problem you are having with rclone?

rclone -i rmdirs drive-me: -v --drive-trashed-only=true might have picked up a non-empty, non-trashed file.

Additionally, I wanted to ask if the commands run produced intended behavior, and would like some clarifications for the commands. In general, I was adding files to the remote and deleting those files to the trash bin on the remote via rclone CLIs and rclone web GUI. I was also trying to permanently delete files in the trash bin.

What is your rclone version (output from rclone version)

rclone v1.54.0

  • os/arch: darwin/amd64
  • go version: go1.15.7

Which OS you are using and how many bits (eg Windows 7, 64 bit)

macOS High Sierra 10.13.6, 64 bit

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

Google Drive remote named "drive-me"

The rclone config contents with secrets removed.

"drive-me" with configs:

[drive-me]
type = drive
scope = drive.file

Note the scope is drive.file.

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

  1. Used rclone CLIs to add a new folder, named rclone containing the file Some File.md, to drive-me
  2. Used the Drive interface to delete rclone to the trash bin
  3. Used the web GUI to create a folder, named huehue in drive-me
  4. In huehue, uploaded the file Some File.md
  5. Tried to delete empty dirs in my Drive trash bin, i.e. dir rclone

The output of my commands for step 5

MacBook-Pro:proj ejy$ rclone ls drive-me: --drive-trashed-only
       10 rclone/Some File.md
MacBook-Pro:proj ejy$ rclone purge drive-me:rclone --drive-trashed-only
2021/03/07 22:49:00 ERROR : Attempt 1/3 failed with 1 errors and: Can't purge with --drive-trashed-only. Use delete if you want to selectively delete files
2021/03/07 22:49:00 ERROR : Attempt 2/3 failed with 1 errors and: Can't purge with --drive-trashed-only. Use delete if you want to selectively delete files
2021/03/07 22:49:00 ERROR : Attempt 3/3 failed with 1 errors and: Can't purge with --drive-trashed-only. Use delete if you want to selectively delete files
2021/03/07 22:49:00 Failed to purge: Can't purge with --drive-trashed-only. Use delete if you want to selectively delete files
MacBook-Pro:proj ejy$ rclone -i delete drive-me: -v --drive-trashed-only=true --drive-use-trash=false
rclone: delete "rclone/Some File.md"?
y) Yes, this is OK (default)
n) No, skip this
s) Skip all delete operations with no more questions
!) Do all delete operations with no more questions
q) Exit rclone now.
y/n/s/!/q> y
2021/03/07 22:57:26 INFO  : rclone/Some File.md: Deleted
MacBook-Pro:proj ejy$ rclone ls drive-me: --drive-trashed-only
MacBook-Pro:proj ejy$ rclone lsd drive-me: --drive-trashed-only
          -1 2021-03-07 22:26:40        -1 huehue
          -1 2021-03-07 20:09:43        -1 rclone
MacBook-Pro:proj ejy$ rclone -i rmdirs drive-me: -v --drive-trashed-only=true
rclone: remove directory "rclone"?
y) Yes, this is OK (default)
n) No, skip this
s) Skip all remove directory operations with no more questions
!) Do all remove directory operations with no more questions
q) Exit rclone now.
y/n/s/!/q> y
rclone: remove directory "huehue"?
y) Yes, this is OK (default)
n) No, skip this
s) Skip all remove directory operations with no more questions
!) Do all remove directory operations with no more questions
q) Exit rclone now.
y/n/s/!/q> n
2021/03/07 23:02:12 NOTICE: huehue: Skipped remove directory as --interactive is set
rclone: remove directory "Google drive root ''"?
y) Yes, this is OK (default)
n) No, skip this
s) Skip all remove directory operations with no more questions
!) Do all remove directory operations with no more questions
q) Exit rclone now.
y/n/s/!/q> n
2021/03/07 23:02:17 NOTICE: Google drive root '': Skipped remove directory as --interactive is set
MacBook-Pro:proj ejy$ 

where nonempty huehue is being detected by rmdirs.

The above steps have been reproduced with another file.

Snapshot of current Google Drive

(couldn't upload more than 1 image due to status as new user, thus the descriptions)

A log from the command with the -vv flag

Hmm... --drive-trashed-only=true works more like a filter so shows files that are shares and hides files which aren't.

If you have a directory with both shared files and non-shared files in then I think that rmdirs could try to delete a non-empty directory.

Does this make sense? I wasn't sure which files were shared and non-shared in your description above so I may not have 100% understood.

For taking the time to respond to my request, I highly appreciate it Nick.

By shares or shared files, do you mean the file has been shared with others on Google Drive? Or do you mean files shared via rclone?

To clarify: In the above steps (1) I rclone copy then rclone delete/rmdirs a folder, then (2) I created a new folder via rclone's web GUI and (3) uploaded a local file to that folder via the GUI. The pictures indicate the state of the Google Drive after those changes. Perhaps I misunderstood how to use the GUI?

Hope I clarified any confusion I caused.

Sorry it is me that is confused you are using trashed only not shared only!

I think the same reasoning applies though

I replicated your problem like this

$ echo hello | rclone rcat drive:test/trashed-only/not-trashed/not-trashed.txt
$ echo hello | rclone rcat drive:test/trashed-only/trashed/trashed.txt
$ rclone delete drive:test/trashed-only/trashed/trashed.txt

$ rclone lsf -R --drive-trashed-only drive:test/trashed-only
trashed/
not-trashed/
trashed/trashed.txt

$ rclone lsf -R drive:test/trashed-only
trashed/
not-trashed/
not-trashed/not-trashed.txt

$ rclone rmdirs -vv --drive-trashed-only drive:test/trashed-only
2021/03/11 14:18:33 DEBUG : not-trashed: Removing directory
2021/03/11 14:18:36 DEBUG : not-trashed: Rmdir: contains file: "not-trashed.txt"
2021/03/11 14:18:36 ERROR : not-trashed: Failed to rmdir: directory not empty
2021/03/11 14:18:36 ERROR : Attempt 1/3 failed with 1 errors and: directory not empty
2021/03/11 14:18:37 DEBUG : not-trashed: Removing directory
2021/03/11 14:18:38 DEBUG : not-trashed: Rmdir: contains file: "not-trashed.txt"
2021/03/11 14:18:38 ERROR : not-trashed: Failed to rmdir: directory not empty
2021/03/11 14:18:38 ERROR : Attempt 2/3 failed with 1 errors and: directory not empty
2021/03/11 14:18:38 DEBUG : not-trashed: Removing directory
2021/03/11 14:18:38 DEBUG : not-trashed: Rmdir: contains file: "not-trashed.txt"
2021/03/11 14:18:38 ERROR : not-trashed: Failed to rmdir: directory not empty
2021/03/11 14:18:38 ERROR : Attempt 3/3 failed with 1 errors and: directory not empty
2021/03/11 14:18:38 DEBUG : 6 go routines active
2021/03/11 14:18:38 Failed to rmdirs: directory not empty

So the deletion didn't happen which is good, but the error is strange.

I'm not sure what to do about this -it isn't easy to fix as the rclone rmdirs level is way above the level which knows that drive is looking at trashed files and there may be other files in the directory.

I guess it may be a bit odd, but it didn't delete anything it shouldn't have done.

For sure. I'd expect:

  • rclone lsf -R --drive-trashed-only to show only trashed/trashed.txt
  • rclone rmdirs --drive-trashed-only to only remove empty trashed/
    And yet rclone rmdirs --drive-trashed-only picks up non-trashed directories, empty or non-empty.

It's all right if this remains unresolved. I'll continue to find solutions or work extra carefully with rclone. Many thanks Nick!

I can't think of a sensible solution at the moment! It would be like using rclone rmdirs with filters which would probably go wrong in a similar way.

:slight_smile:

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