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

link|improve this question

0% accept rate
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
feedback

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

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

1 Answer

Use rmdir:

rmdir [path to folder]
link|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
feedback

Your Answer

 
or
required, but never shown

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