1

This question already has an answer here:

I have a weird situation with a file that sticked into my file system and apparently there is nothing I can do to remove it. There is a file in the Trash folder of my external hard drive, and it can not be deleted. Trying with mac "Empty Trash" it says the file is in use:

"The operation can’t be completed because the item “Funny Film” is in use."

I tried to remove the file/folders from command line:

$ pwd
Volumes/My Book/.Trashes/501/Clip old/Funny Film

$ ls
000␀0000.␀P4

$ rm 000␀0000.␀P4
rm: 000␀0000.␀P4: No such file or directory

$ ls -i
ls: 000␀0000.␀P4: No such file or directory

$ ls -l 
ls: 000␀0000.␀P4: No such file or directory

$ stat ./000␀0000.␀P4
stat: ./000␀0000.␀P4: stat: No such file or directory

I had this problem for some time now. I have tried several different things without success. The external hard drive have been used over ftp, with Windows, Ubuntu and Mac operation systems. How it is possible that 'ls' finds the file while 'ls -l' failed? More importantly, how I can fix the situation and delete the file?

marked as duplicate by Mateusz Szlosek, nohillside Aug 18 '16 at 6:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • How is your My Book formatted, what filesystem is it using? – user3439894 Aug 18 '16 at 3:16
  • What's the file system of the external drive (if it has been used with Win/Ubu also, probably ExFAT) and the OS X system version? – klanomath Aug 18 '16 at 3:45
  • The bug is fixed on macOS 10.12 – Mateusz Szlosek Aug 18 '16 at 5:56
  • "My Book" external drive is a 1TB MS DOS (FAT) external hard drive, I have used it with Windows, ubuntu and MAC. The folder structure that are not deletable right now, was created on Windows. I have OSX El Capitan 10.11.6 – Pejman Habashi Aug 21 '16 at 17:00
0

Use ls -i On the entire directory. Then use the find command to pass the inode to rm.

  • I have this, but ls -i can not find the file. You may see the result of ls -i in the example I have provided. – Pejman Habashi Aug 21 '16 at 17:01
  • I have tried to run as requested in the link provided: rm: ./Funny Film: is a directory; find: ./Funny Film/000␀0000.␀P4: No such file or directory – Pejman Habashi Aug 21 '16 at 17:12
-2

The easiest way is to use El Capitan Cache Cleaner (free), which has an option to "Force Empty Trash". As for the rm command not deleting file it is most likely confused with the file name, which is very hard to enter properly escaped. There are at least three ways of dealing with it. First is by using quotes or backslashes to get around special characters in the file name, the other is to use an asterisk (*) to get all files, and the third is to use the -delete option in the find command to find and delete found files. Hope this helps.

Not the answer you're looking for? Browse other questions tagged .