Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
2  
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

2 Answers 2

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
1  
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
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.