Trying to delete directory with "rm -rf", but get message that it's not empty
Posted
by
Ben Hocking
on Super User
See other posts from Super User
or by Ben Hocking
Published on 2012-08-27T19:39:10Z
Indexed on
2012/08/27
21:42 UTC
Read the original article
Hit count: 338
I've tried deleting a directory using "rm -rf" and I'm getting the message "Directory not empty":
Bens-MacBook-Pro:please benjaminhocking$ ls -lart empty_directory/
total 16
drwxr-xr-x 5 benjaminhocking staff 170 Aug 27 14:46 .
drwxr-xr-x 3 benjaminhocking staff 102 Aug 27 15:28 ..
Bens-MacBook-Pro:please benjaminhocking$ rm -rf empty_directory/
rm: empty_directory/: Directory not empty
Bens-MacBook-Pro:please benjaminhocking$ rmdir empty_directory/
rmdir: empty_directory/: Directory not empty
If I try the same thing using Finder (dragging the folder to the Trash), I get the message
The operation can’t be completed because the item “empty_directory” is in use.
I've tried doing xattr -d com.apple.quarantine
, purely out of superstition, but it did no good.
A probably important piece of context is that this directory was initially in a directory that should've been deleted by a "make clean" command I issued prior to Terminal locking up on me, after which a little over half of the other programs I had running also locked up, including Skype, and eventually the OS itself. I ended up having to reboot the computer by pressing and holding the power key.
Edit to add: Another important piece of information I left off was that this was happening in an encrypted folder à la encfs
. I was able to track down the corresponding folder in the encrypted side of things and delete it there. I still don't know why I couldn't do it from the decrypted side of things like I normally do. I'll leave this unanswered for now in case anyone has a good answer for that.
© Super User or respective owner