Can't empty a file in the trash

I have a directory that I have named "bad". I have tried every suggestion on the web to empty it from the trash. It has been on my boot drive for a couple of years and even survived the transition to Big Sur. Even the nuclear option in terminal (rm -fr bad) fails, with the message "directory not empty". However, the directory has no visible or invisible files. I even booted to the recovery disk, ran Diskutil repair of the container as well as the Data directory of MacintoshHD. Then I tried rm -fr bad again (from the Recovery disk) and got the same message. I also tried rmdir -p bad but got the message "directory not empty". The -fr and -p options are supposed to delete directories, empty or not. I then tried again to see if there are any invisible files in bad. I ran ls -a bad and it returned . and .. as the only invisible files. I have also taken the directory bad out of the trash and tried rm, with the same result. Does anyone have a suggestion other than wiping the drive to get rid of this file?

MacBook Pro 13″, macOS 11.4

Posted on Jul 18, 2021 10:41 AM

Reply

Similar questions

7 replies

Jul 18, 2021 2:55 PM in response to Owl-53

Thank you, both. I guess I'll just hide the file again in an out-of-the-way place for another few years. I got a similar message when trying to empty the trash (after disabling SIP): "The operation can't be completed because the item 'bad' is in use". I then opened Terminal and entered lsof path-to-trash/bad but no processes were listed.

Jul 18, 2021 12:19 PM in response to Owl-53

Good suggestion. Thank you. I just now tried it. I disabled SIP and then executed both rm and rmdir from the recovery disk but got the same message. I rebooted and tried sudo rm but was still told "Directory not empty". What is left to try? GetInfo says the file is not locked but it lists me twice with read-write privileges. I tried to delete one of them but the minus sign is dimmed. If I should use terminal to change owner and permissions, I would probably need explicit directions as I am not very familiar doing that.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Can't empty a file in the trash

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.