How to delete a Non Empty directory in Windows command line.

How to delete a Non Empty directory in Windows is a very basic question that might arise when you work with windows command line.

Lets say you have created a directory named “ToBeDeleted” using:

mkdir ToBeDeleted

and few directories within “ToBeDeleted” directory:

mkdir ToBeDeletedA
mkdir ToBeDeletedB
mkdir ToBeDeletedC

and you add some files to each of these folders:

dir > ToBeDeletedAfile1.txt
dir > ToBeDeletedBfile2.txt
dir > ToBeDeletedCfile3.txt

Now a simple rmdir “ToBeDeleted” will not work. So you will need to use:

rmdir /s ToBeDeleted

Leave a Reply

Your email address will not be published. Required fields are marked *