# rm -rf: Unix thinks '-rf' is a file not an option

I run the following command in Terminal on my OS X Snow Leopard laptop:

rm -rf /path/to/directory


Normally, this deletes the directory and all contents/subdirectories. For some reason, though, it now gives the following error message:

rm: –rf: No such file or directory
rm: /path/to/directory: is a directory


I'd be grateful if somebody could share why rm doesn't recognize '-rf' as an option string?

-

## migrated from stackoverflow.comSep 11 '10 at 6:19

This question came from our site for professional and enthusiast programmers.

Voted to move to superuser. Stack Overflow is for programming questions. –  jer Sep 11 '10 at 6:17

In your second "code" block, you're using – instead of -.

The – character you're using is not the - ASCII character that is used to prefix command line options, therefore –rf is interpreted as a file name.

Use rm -rf /path/to/directory.

-
Nice catch. The character in the quoted rm: –rf: No such file or directory message is U+2013 EN DASH, not the normal option introducing character U+002D HYPHEN-MINUS. Probably the result of copying and pasting some overzealously re-formatted text from a web page of some sort. –  Chris Johnsen Sep 11 '10 at 6:35
You're absolutely right, thanks for the quick response! –  Danny Goodman Sep 12 '10 at 9:57

Is rm aliased to something? rm will interpret -rf as a file name if it somehow has -- in the argument list, as in rm -- -rf /path/directory.

Try it with a backslash in front, which disables aliases. Or use the full path:

\rm -rf /path/directory
/bin/rm -rf /path/directory

-

Are you sure you're feeding it the correct path name? If it contains spaces, make sure you include quotation marks.

rm -rf "/my folder/here"

-

Just a random thing to try. Have you tried:

rm -r -f /path/to/directory

-