Unable to delete R2 empty directories

Hello, I’m unable to delete a ton of nested empty directories from an R2 bucket. On the web GUI, each directory shows an ‘unknown’ file. No matter what I try, there seems to be no way to delete those from command line, and there are far too many to do on the web GUI. I’ve checked for unfinished file uploads too, to no avail.

user@server:~$ rclone cleanup r2:bucketName
user@server:~$ rclone backend list-multipart-uploads r2:bucketName
{
	"bucketName": []
}
user@server:~$ rclone purge r2:bucketName
2023/03/07 02:35:00 ERROR : : Failed to rmdir: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account <redacted>).
	status code: 409, request id: , host id: 
2023/03/07 02:35:00 ERROR : Attempt 1/3 failed with 1 errors and: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account <redacted>).
	status code: 409, request id: , host id: 
2023/03/07 02:35:04 ERROR : : Failed to rmdir: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account <redacted>).
	status code: 409, request id: , host id: 
2023/03/07 02:35:04 ERROR : Attempt 2/3 failed with 1 errors and: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account <redacted>).
	status code: 409, request id: , host id: 
2023/03/07 02:35:08 ERROR : : Failed to rmdir: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account <redacted>).
	status code: 409, request id: , host id: 
2023/03/07 02:35:08 ERROR : Attempt 3/3 failed with 1 errors and: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account <redacted>).
	status code: 409, request id: , host id: 
2023/03/07 02:35:08 Failed to purge: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account <redacted>).
	status code: 409, request id: , host id: 
user@server:~$ rclone ls r2:bucketName
user@server:~$ 

When ran with verbose usage, it looks like the directory removes aren’t failing? And rclone is unable to see the strange ‘unnamed’ files, or delete them I guess? So not sure what’s going on here…

user@server:~$ rclone purge r2:bucketName/ -vv
2023/03/07 02:46:13 DEBUG : rclone: Version "v1.53.3-DEV" starting with parameters ["rclone" "purge" "r2:bucketName/" "-vv"]
2023/03/07 02:46:13 DEBUG : Creating backend with remote "r2:bucketName/"
2023/03/07 02:46:13 DEBUG : Using config file from "/home/debian/.config/rclone/rclone.conf"
2023/03/07 02:46:13 DEBUG : fs cache: renaming cache item "r2:bucketName/" to be canonical "r2:bucketName"
2023/03/07 02:46:13 DEBUG : Waiting for deletions to finish
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/robthree/twofactorauth/lib/Providers/Time: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/robthree/twofactorauth/lib/Providers/Rng: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/robthree/twofactorauth/lib/Providers/Qr: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/robthree/twofactorauth/lib/Providers: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/robthree/twofactorauth/lib: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/robthree/twofactorauth: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/robthree: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/phpmailer/phpmailer/src: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/phpmailer/phpmailer/language: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/phpmailer/phpmailer: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/phpmailer: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/paragonie/random_compat/lib: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/paragonie/random_compat: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/paragonie: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor/composer: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/vendor: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/view-ticket/partial: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/view-ticket: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/util: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/knowledgebase: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/js: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/img: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/fonts: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/css: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer/create-ticket: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3/customer: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme/appname3: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/theme: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/language/en/html_emails: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/language/en/help_files: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/language/en/emails: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/language/en: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/language: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/js/timeago/locales: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/js/timeago: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/js: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/install/img: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/install: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/zip: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/treemenu: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/themes/silver: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/themes/mobile: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/themes: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/ui/oxide/fonts: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/ui/oxide-dark/fonts: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/ui/oxide-dark: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/ui/oxide: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/ui: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/content/writer: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/content/document: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/content/default: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/content/dark: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins/content: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/skins: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/wordcount: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/visualchars: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/visualblocks: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/toc: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/textpattern: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/textcolor: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/template: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/table: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/tabfocus: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/spellchecker: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/searchreplace: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/save: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/quickbars: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/print: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/preview: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/paste: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/pagebreak: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/noneditable: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/nonbreaking: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/media: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/lists: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/link: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/legacyoutput: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/insertdatetime: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/importcss: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/imagetools: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/image: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/hr: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/help: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/fullscreen: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/fullpage: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/emoticons/js: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/emoticons: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/directionality: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/contextmenu: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/colorpicker: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/codesample: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/code: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/charmap: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/bbcode: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/autosave: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/autoresize: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/autolink: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/anchor: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins/advlist: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/plugins: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/langs: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/icons/default: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6/icons: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce/5.10.6: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tiny_mce: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/timer: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/tabs: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/recaptcha: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/mail/sasl: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/mail/imap: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/mail: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/jscolor: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/Printer: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/Lexer: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/Language/messages: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/Language/classes: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/Language: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/Filter: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/EntityLookup: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/ConfigSchema/schema: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/ConfigSchema/Interchange: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/ConfigSchema/Builder: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier/ConfigSchema: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone/HTMLPurifier: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier/standalone: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc/htmlpurifier: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app/inc: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test/app: Removing directory
2023/03/07 02:46:17 DEBUG : appname-test: Removing directory
2023/03/07 02:46:17 DEBUG : S3 bucket bucketName: Removing directory
2023/03/07 02:46:17 ERROR : : Failed to rmdir: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account redacted).
	status code: 409, request id: , host id: 
2023/03/07 02:46:17 ERROR : Attempt 1/3 failed with 1 errors and: BucketNotEmpty: The bucket you tried to delete (bucketName) is not empty (account redacted).
	status code: 409, request id: , host id: 
2023/03/07 02:46:17 DEBUG : Waiting for deletions to finish

Hi there, thanks for contacting Cloudflare.

This looks similar to R2, Ghost file phenomenon

Can you please email me your account ids to lcardoso at cloudflare.com, so I can create a support ticket for this and proceed troubleshooting it further?

1 Like

Hello again Mitch,

I raised the support ticket 2728482 to address this issue. You should receive an update on your email address associated to the account in question.

Rest assured, we will investigate this further and provide you with an update soon.

2 Likes

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