Skip to content

operations: fix rmdirs failing on directories which only look empty -… - #10011

Open
Karthikvanabhojana1 wants to merge 1 commit into
rclone:masterfrom
Karthikvanabhojana1:fix/9907-rmdirs-directory-not-empty
Open

Karthikvanabhojana1 wants to merge 1 commit into
rclone:masterfrom
Karthikvanabhojana1:fix/9907-rmdirs-directory-not-empty

Conversation

@Karthikvanabhojana1

@Karthikvanabhojana1 Karthikvanabhojana1 commented Sep 30, 2026 •

Copy link
Copy Markdown

… fixes #9907

Google Drive leaves out of its listings any Google Doc it has no export format for, such as a .gform. rmdirs therefore saw a directory holding only such a file as empty, tried to remove it, and failed the whole run with "directory not empty".

A directory which turns out not to be empty is not a failure for rmdirs, whose job is to remove the empty ones, so skip it and carry on. This also covers a file arriving between the listing and the removal. sync already ignores this error when it prunes empty directories.

The drive backend reported this case as a bare error rather than fs.ErrorDirectoryNotEmpty, so it now returns the standard error like the other backends, which is what makes it recognisable here.

What does this change do?

Linked issue

Fixes #

For new or changed backends

Checklist

  • This change is trivial OR it has been discussed and agreed in the linked issue.
  • I have read the contribution guidelines.
  • (If I used AI tools to help write this code) I have read and understood the AI-assisted contributions guidance, and I have tested and take ownership of this change myself.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • (Backend changes only) test_all passes for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.
  • This Pull Request is ready for review.

…ixes rclone#9907

Google Drive leaves out of its listings any Google Doc it has no export
format for, such as a .gform. rmdirs therefore saw a directory holding
only such a file as empty, tried to remove it, and failed the whole run
with "directory not empty".

A directory which turns out not to be empty is not a failure for rmdirs,
whose job is to remove the empty ones, so skip it and carry on. This also
covers a file arriving between the listing and the removal. sync already
ignores this error when it prunes empty directories.

The drive backend reported this case as a bare error rather than
fs.ErrorDirectoryNotEmpty, so it now returns the standard error like the
other backends, which is what makes it recognisable here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rmdirs is attempting to delete not empty directory with *.gform files

1 participant