Skip to main content

How To Delete or Remove a Directory in MS DOS

To delete a directory in MS DOS, the command is rmdir (remove directory). For Example : rmdir (space) path of the directory and then press enter on keyboard.


Say, if there is a file manidin in the D drive under a directory rafipedia that means the path of the file is D:\rafipedia\manidin.

If you put command rmdir d:\rafipedia on DOS command prompt and press Enter on keyboard. You will find an error. The directory rafipedia do not deleted. Because there is a file manidin in that directory. 

To delete or remove  a directory be sure that the directory is empty. So first delete the file manidin. The complete command is to delete the file and directory is

1. open DOS Command Prompt
2. type d: and press enter on keyboard
3. type cd rafipedia (directory name) to enter into the directory
4. type delete manidin (file name) and press Enter on keyboad.

Now your file manidin is deleted.

5. type cd .. to come out from directory rafipedia
6. type rmdir D:\rafipedia 

Now the directory rafipedia will be deleted.