On my iMac I have a folder, left from preceding systems, named "ZipIt 2.2.2␀". I cannot delete or rename it, nor delete the files it contains, both from the Finder and from Terminal. Looking at this question and related answers I understand this is a bug of Mac OS 10.11 (and later?), connected to the presence of NUL character in the name.

I haven't an older Mac OS at hand. I tried to rename the folder with Onyx and A Better Finder Rename 10 but without success. I also tried to boot from Mac OS Recovery but couldn't do anything useful.

Any ideas?


Here's the output I get from Terminal when using find:

    % ls -li
    total 0
    1067625 drwxrwxrwx+ 6 root  wheel  204 25 Mag  2011 ZipIt 2.2.2␀

    % sudo find . -inum 1067625 -mount -exec rm -rf {} \;
    rm: ./ZipIt 2.2.2␀/.DS_Store: Invalid argument

[... many similar lines ...]

    rm: ./ZipIt 2.2.2␀: Invalid argument


I thought of a possible way out, but don't know if it's viable. I could create a new user, transfer the offending folder to its desktop, then delete the user.

Do you think this could be effective? I'd like to try, but I'm afraid this could hang the whole system.


As requested by Allan, here's the detailed content of the folder I cannot delete:

% find . -type d -name 'Zip*' -print0 | xargs -0 -J -t ls
./ZipIt 2.2.2␀:
Drop files here to zip (OS_X)   ZipIt.app
Read me.pdf

./ZipIt 2.2.2␀/ZipIt.app:
Contents    ZipIt

./ZipIt 2.2.2␀/ZipIt.app/Contents/Resources/ZipIt Help:
ZipIt Help idx  ZipIt help  faq     images
  • can you hardlink a directory to the inode, then you can at least delete the files. Will repair file system in disk utility fix the directory name? Commented Jan 15, 2019 at 1:19

2 Answers 2


Using the bash shell, you can try the completion feature. Example

Ravens-Claw:tmp garex$ mkdir "this\ is\ a\ bad\ folder\ with\ äü\ encoding"
Ravens-Claw:tmp garex$ ls -ltr | tail -1
drwxr-xr-x  2 garex  wheel   68 13 Jun 19:17 this\ is\ a\ bad\ folder\ with\ äü\ encoding
Ravens-Claw:tmp garex$ rm -rf "this\\ is\\ a\\ bad\\ folder\\ with\\ äü\\ encoding"/

Just type rm -rf "this, hit TAB key and bash will do the rest. Don't forget to close the ".

For files with strange filenames, you can try:

rm -- "<start typing filename and hit TAB key>"
  • Doesn't work: the usual sequence of "Invalid argument" appears. It is not a problem of the Terminal, it is the OS refusing to understand a name containing "NUL". Commented Jun 13, 2018 at 21:05

Try removing it via the inode.

First, get the inode:

$ls -li

275505305 drwxr-xr-x   2 allan  staff    68B Jun 11 10:33 foobar

The inode is the first column of numbers. Then using that number execute the following command:

$ find . -inum XXXXXXXXX -mount -exec rm -rf {} \; 

Where XXXXXXXXX is the actual inode of the file/directory you want to delete.

  • Tried that (with -r only) and only got a sequel of "Invalid argument". Also tried with mv instead of rm and got the same result. Commented Jun 11, 2018 at 14:51
  • Please post the output of the $ls -li and the exact command you used. It's tough to see what's happening this far away.
    – Allan
    Commented Jun 11, 2018 at 15:02
  • I added that to my question. Commented Jun 11, 2018 at 15:42
  • It's owned by root Preface the command with sudo.
    – Allan
    Commented Jun 11, 2018 at 15:55
  • I get rm: ./ZipIt 2.2.2␀/.DS_Store: Invalid argument and so on. I suspect there is nothing to do. Commented Jun 11, 2018 at 18:08

You must log in to answer this question.

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