In Finder and Terminal — can not delete a folder, (Error = "Directory not empty")
Anytime I've run up against this in the past, I was always able to figure it out, and usually via the command line. I'll list all the commands I tried so far, followed by other things I've tried below that.
Commands I've tried so far, and were also ran as root
using sudo su root
:
rm -rf <folderName>
rmdir <folderName>
-
ls -@RelO
(shows folder is empty) -
ls -Rail
(shows empty) -
ls -ri
(shows empty) -
xattr
(I finally removed the extended attributes of this folder, asls -la
showed an@
at the end of the permissions.drwxr-xr-x@ 3 mike staff 96 Jan 23 23:29 iPhoto Library
As mentioned, in addition to these Terminal commands, I...
- Booted into Safe Mode (still says "Directory not empty")
- Booted into Recovery Mode, then ran
csrutil disable
to turn off System Integrity Protection, and rebooted as normal. Then, from Terminal (again, viasudo su root
), ran all of the same commands. It keeps saying "Directory not empty". - Booted into Single User mode, navigated to the folder, and ran the above commands (was sure this would work). It still reads, "Directory not empty"
- Not copied, but moved this to a thumb drive (command key + drag to volume), a message read, "Was able to move folder, but can't delete existing one".
You may have noticed this is my old iPhoto Library file. Just so you know, I've finally (after many years) consolidated my newer "Photos" library, so I wanted to get rid of this, as it's almost 90 GB. And yes, I did 'right-click' to "Show Contents", then was able to get rid of everything inside of this folder, but can not get rid of the top-level folder.
I have never been stumped like this (I'm a Mac tech for 23 years). This is quite the forced feeding of some seriously humble pie.
Hi David and Igor — Issue is resolved, but the solution is not something I'd have considered as even being a relevant one, but I wanted to post it here for whoever this might help in the future (as well as put closure to Igor's / Dave's possible curiosity. And once again, thank you guys for all your suggestions.
For a completely different (separate) reason, I logged out of iCloud (on the Mac — not iPhone or iPad). Went through all the usual items (saved my stuff locally), etc., and somehow - when I logged back in, my trash was empty!
One of the things I wanted to share here with this forum / group, is that I learned something I hadn't known previously: Since the incarnation of iCloud, the PATH to my "Trash" folder no longer is (what it's always been)... /Users/myHomeDir/.Trash — instead, it was now: myHomeDir$ /Users/mike/Library/Mobile\ Documents/com\~apple\~CloudDocs/.Trash/ — and I only learned this after searching that first path several times, both while logged in as myself (in Terminal), but also, while booted into Single User mode. Nowhere in either of those means, was my Trash directory located. But when I drag and dropped that from my trash... to my terminal - that was the path it gave. (and confirmed this while logged into Single User).
Go figure... sorry for the lengthy post, but wanted to be thorough in my resolution for anybody this might help. But all this said, I guess that since the advent of iCloud, this is now the default location for everybody's Trash folder? This presents an entire new thread of questions for me (Apple's implementation of their folder hierarchy, since iCloud) - but no questions specifically at the moment.