In this tutorial we will be talking about the creation of directories, removal of directories, and deleting files within DOS. When juxtaposed with navigation, this can be a powerful ally when removing viruses, recovering data on a bad hard drive, deleting stubborn files, and accomplishing simple tasks easily and effectively.

Disclaimer: I am not responsible for any mistakes you make while using DOS. These tutorials are merely for information purposes only.


Often, we might hear the question, "why would you wast time doing this in dos when you can just right-click and make a new folder or hit delete on a keyboard?" DOS is a useful tool to know especially if we're dealing with data recovery in safe mode, virus removal in safe mode, fixing a problem, or using certain 3rd party utilities like Disk Wipe.

Making Directories

Making directories is a useful tool when weeding out good files from bad, old from new, and organizing files in something like safe mode.

For those that are familiar with unix commands, this will be like an old friend. The command for creating a new directory is md or mkdir, both do the same exact thing in DOS.

Although we need not navigate to the directory in which we wish to put our new directory in, we can do so by using the chdir or cd command as seen in the first tutorial. Navigating to the parent directory where we will create a child directory is usually a good idea so we can easily see if the directory was created successfully.

Choose a Directory

C:\> cd C:\users\dennis\music
C:\> cd C:\documents and settings\dennis\my documents\my music

The above line is Vista/7 and the below line is XP.


Once we have chosen, we can create our directory in our music folder like the following:

Create the Directory

mkdir C:\users\dennis\music\test
md C:\documents and settings\dennis\my documents\my music\test

Remember that mkdir and md are both legal when using the command prompt.

This will create the directory called "test" in the drive C:\ with a path to users > music and then it will create the directory.


One common mistake that happens is that some consider the md as a single command and then you type in the name of the directory we want to create. Allow me to demonstrate:

mkdir C:\ test //This is wrong
mkdir C:\test //This is right

The first example has a space between C:\ and "test" and therefore renders the command invalid. If we take a look at a website URL, we'll see that it is almost identical. is pointing to the world wide web address called atomicpages with the TLD of .net to the directory called "images" which contains a file named "stripes.png".

Ironically, the only difference between a URL and DOS is the type of slash that it uses. A website URL uses a forward slash (/) and DOS uses a backslash ($$.

Applying this logic when creating a directory, we can see that it would make sense to merely continue until we reach the directory that will be created.

Deleting Files

Deleting files in DOS is somewhat of a godsend. At times, there are files that you cannot delete regularly using the Windows GUI so we have to resort to DOS to do our bidding for us. This also can be extremely useful when combating a virus in safe mode.

Deletion of files comes in two flavors:

Del Erase
Originally, the DEL command could not have any wildcards in the parameter of the command. So del C:\ *.* /f would not work. ERASE, on the other hand, was specifically created to allow wildcards and also to erase the files.

Do NOT try del C:\ *.* /f or erase C:\ *.* /f unless you want your entire C: drive wiped clean.

There are times when either command is appropriate, however. If a directory or file is being stubborn and the del command is not working, try the erase command instead.

Useful Switches
/p /q /f /a
This prompts before deleting of files. This can be useful if you have to delete a small number of files but don't want a certain file deleted. Enables "quiet mode" where you are not notified to confirm deletion of any files. Useful for a large number of files. Enables a forceful deletion of files Activates attributes that can help you define which files you want to delete. Use del /? for more details.

To further illustrate the minor difference between del and erase, there once was a time where I had a Windows.old file from a clean install from Vista to 7. For the life of me I could not remove this directory. I tried viewing hidden files and folders, tried using del C:\windows.old /f tried rd C:\windows.old and then I tried the following: erase C:\windows.old /f and then finally I was able to remove the directory.

Using Del and Erase

A good way to practice is to go to and generate however many words, paragraphs, or bytes of words you want to create new .txt documents by right-clicking and selecting new from the menu in Windows. Name them different things and then navigate to our test directory and display the files within the directory via dir.

If we want to delete all of the folders, we would type the following:

C:\> del C:\users\dennis\music\test
C:\> del C:\documents and settings\dennis\my documents\my music\test

C:\> del C:\users\dennis\music\test\*
C:\> del C:\documents and settings\dennis\my documents\my music\test\*
Are you sure (Y/N)?


Notice how DOS automatically puts \* at the end so that all files will be deleted. Erase will work and look the same as del in this situation.

Removing Directories

Removing Directories through DOS will save you heartache in the long run especially if the directory is one you could not delete normally through the Windows GUI.

rd or rmdir is the command we would use to remove a directory. If the directory is not empty we'll get an error like the following:


Be sure the directory is empty using the erase command and then do the following:

C:\users\dennis\music\test\> ..\ \\brings you up one dir
C:\users\dennis\music\> rd C:\users\dennis\music\test

C:\> del C:\documents and settings\dennis\my documents\my music\test\> ..\ \\brings you up one dir
C:\> del C:\documents and settings\dennis\my documents\my music\>
rd C:\> del C:\documents and settings\dennis\my documents\my music\test


The ..\ literally brings us up one parent directory or up one level in the file tree.

That's it! Now you know how to use basic commands that allow you to create folders, delete files, and to remove folders from your hard drive.

Be Sociable, Share!