How to delete a non empty directory in linux

In this article let’s discuss about How to delete a non empty directory in linux. Let’s go through the following methods without any delay.

Method 1:

1. To recursively delete use

$ rm -r dirname

2.To forcefully delete use

$ rm -rf dirname

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar by have a try!

Method 2 :

//remove a non empty directory
rm -r dir1

//remove a directory within directory without being promopted
rm -rf dir1

Hope the above solution works.

Realted Posts : Express generator