Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to remove a folder with

rm -rf foldername

… but it says

rm: cannot remove folder :is a directory.

What's wrong?

share|improve this question
I know it goes without saying but given the question; be very careful with rm, particularly with -r being used. its one of the commands you really want to make sure you know what it'll do. Try using -i which will prompt for each deletion, until you get comfortable with it. – Sirex Oct 20 '11 at 11:27
Does the folder you are trying to delete contain any special characters or spaces? Have you tried putting foldername in quotes? – chuck Oct 20 '11 at 12:23
The issue is difficult to explain without knowing further details. Are there really no other error messages? Could be that one or more files could not be removed because of permission problems. In this case the parent directory cannot be removed also. – ktf Oct 20 '11 at 12:56
up vote 2 down vote accepted

Omit the space between - and rf.

share|improve this answer
sorry, i mistyped. there is no space between - and rf actually. – alwbtc Oct 20 '11 at 11:39
what does ls -l foldername and whoami give ? – Sirex Oct 20 '11 at 12:14
sorry, an admin has told me that there is a script that removes -rf whenever I use it. problem is solved. – alwbtc Nov 3 '11 at 13:50
LOL! Worthy to be remembered in the all time favourites UNIX issues :) – ktf Nov 3 '11 at 14:37

Is the foldername you're trying to remove literally . Because it is defined as an error to attempt to remove . and ... Instead, change one level up and then remove it.

share|improve this answer

You must log in to answer this question.

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