Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 am using Fedora10 linux. I want to delete a folder if that folder doesnot have any file or subdirectories inside it. I know the path of the folder.

What is the command to delete a folder is the folder doesnot have any files or sub directories.

Sunil Kumar Sahoo

share|improve this question

migrated from Nov 18 '09 at 14:13

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

Also a duplicate of – Pascal Cuoq Nov 18 '09 at 13:08
Hi Pascal, The question is not duplicate. In this question I want if my directory is empty then only delete otherwise donot delete the directory. – Sunil Kumar Sahoo Nov 18 '09 at 13:13

Use rmdir:

rmdir [path to folder]
share|improve this answer
rmdir will remove the directory irrespective of knowing whether the directory is empty or not – Sunil Kumar Sahoo Nov 18 '09 at 13:15
Sorry rjmunro, U are right. I right. I got success after using rmdir. Thanks alot. – Sunil Kumar Sahoo Nov 18 '09 at 13:44

Your Answer


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.