" Directory not empty " Error While Deleting Directory Using "rmdir" Command


" Directory not empty " Error While Deleting Directory Using "rmdir" Command



Hello Friend's.....
Once Again I Am Back With Little Solution Of Very Common Problem.
So, Many Linux User's (Mostly Beginner's) Use The "rmdir" Command For Deleting The Directory.
But, Some Time They All Are (Maybe) Facing One Problem.

" rmdir: failed to remove ‘DirectoryName’: Directory not empty "

Because This Directory Is Not Empty. There Is Any Files / Directories In That Directory.
So, Now What We Can Do....????

Use The " rm -rf " Command.

Example : " rm -rf DirectoryName "

Please Note :
This will delete the directory including all the files and sub-directories. This is very dangerous when you use it accidentally as you cannot recover those files easily. So it is strongly recommended that you pay attention and think twice before executing the rm -rf command.

 All The Following rm Options Are Valid And Does Same Functionality.

i.e. Recursive And Forcefully Delete.

  • rm -fr
  • rm -rf
  • rm -f -r
  • rm -r -f 
So , Thank You For Reading This Article. I Hope This Article Is Helpful For You.

Please Share This Article With Your Social Network .

Harshil Patel

Author & Editor

Hello Friend's.... Thank You For Visiting My Blog. I Am Computer Geek And I Like To Share My Knowledge And Educate Other's. I Love LINUX Forever.