I was clearing a music folder in my external drive and found a directory I can't delete no matter what I try.
If I put it in trash bin via GUI
The operation can’t be completed because the item “folder” is in use.
If I use rm -rf
to remove it via terminal
$ rm -rf folder/
rm: folder/: Directory not empty
If I use ls -la
to check its content
$ ls -la
total 512
drwxrwxrwx 1 user staff 131072 Jan 3 2017 .
drwxrwxrwx 1 user staff 131072 Jan 3 2017 ..
If I use rm -i *
within the folder
$ rm -i *
rm: 03 - Ēlusion.mp3: No such file or directory
If I use sudo lsof +D folder/
to check if any files are opened
Nothing returns on program exit.
If I use Disk Utility to repair (first aid) disk and volume
Health check passed so no repair was initiated.
If I reboot macOS
The issue persists.
Additional info:
I can move the folder within the drive, but not to another drive.
I can rename the folder.
ls -i *.mp3
returnsls: 03 - Ēlusion.mp3: No such file or directory
, same asrm -i *.mp3
.The file doesn't show up in Finder, that's confusing part, whatever filename display issue Terminal could have (I always set it to use
Unicode - UTF-8
), I think there are more force at play.
In response to questions, nope, ls -ib
doesn't return anything.
$ ls -i
$ ls -ib
$ ls -laib
total 512
2762318 drwxrwxrwx 1 user staff 131072 Jan 3 2017 .
2685260 drwxrwxrwx 1 user staff 131072 Jan 3 2017 ..
So apparently there is something in it but ls -la
couldn't see it, while rm -i
is being weird with filename?
get info
via GUI context menu did confirm there is 1 item in the folder, but with zero byte, and certainly doesn't show up in finder.
I am not sure what to do at this point. Help much appreciated!
(Using 10.13.4 + ExFAT on external drive)
ls -b
show the file? If so, you canls -bi
to get the inode and follow the below answer, or alternately just copy the filename in the-b
output.ls -bi *.mp3
show the same result as shown in OP.