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

Thanks
Sunil Kumar Sahoo

share|improve this question

migrated from stackoverflow.com Nov 18 '09 at 14:13

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

    
Also a duplicate of stackoverflow.com/questions/1755689 –  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

1 Answer 1

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

 
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.