1

How to delete or rename files with in their filename in Mac OS X 10.11.2?

Filename—or even a folder—can’t be renamed or deleted when there is this spezial character in it, for example Filename␀ A5 Br.indd or the Folder test␀delete.

The special character is in big letters NUL.

I have already tried some rm in the Terminal by adding the filename with drag and drop, but I only get “Invalid argument.”

Any idea how to solve this kind of problem?

3
  • 1
    Have you tried using the wildcard character with the mv command? e.g. mv test*delete testdelete Dec 13, 2015 at 4:10
  • @olaf, did you ever find a solution to this? I'm having the same issue.
    – Harv
    Jan 7, 2016 at 21:48
  • @olaf I got the answer, see unix.stackexchange.com/questions/253932/…. Steve's answer is correct.
    – Harv
    Mar 13, 2016 at 6:13

2 Answers 2

1

Symptoms: All normal procedures fail to accomplish the task of removing the file, either via Finder or through Terminal (sudo rm, sudo mv). It is not a permissions, access, or file content problem. A new, fresh file can be made undeletable by using the 'nul' character in its name (UTF:\342\220\200) character in its name. File can really only be manipulated by manipulating the parent folder in Finder or Terminal, ie moving/renaming parent.

This is not a 100% solution.

The short solution is to boot your system from an external usb drive with something like Ubuntu installed. Within Ubuntu, you can force mount the problematic drive with RW access and delete the file.

This involves: -creating the bootable Ubuntu USB drive -remount the drives with r/w access -sudo rm the problem files

This only works for HFS+ drives (or other common formats). Unfortunately, modern macs use the filesystem Core Storage. This apparently cannot be read by 3rd-party OS's at present (or for the foreseeable future)

So, the less-than-100% part is that one could go through the potential trouble of reverting their system drive back to HFS+ and following the same route as described above. Or, tuck the errant file(s) away in a dark corner and exclude from TM backups (as the file will transfer and 'infect' TM backups as well).

Specific details purposely left out as the exact steps I followed were not recorded, and very likely will change as time goes on. For now, I have cleaned my external drives of the problematic files, and segregated the local files to a TM-excluded (and Finder-hidden) folder at the HD's root.

PS: drop a note.txt file in the storage folder so when you accidentally stumble upon it later, you know what is going on and why. Also, Apple is aware of, and working on, the problem. But, was not able to provide a solution at the time I calling.

0

Did you:

  • move out all the files from the directory containing the NUL-file, but the NUL-file.
  • remove the directory with NUL-file.

In this manner, the file will be accessed only with his inode and not name, so it should be deleted without troubles.

You must log in to answer this question.

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