# Deleting in DOS



## Whitestar (Mar 22, 2003)

Is there a way to remove a directory from dos without deleting its content first?


----------



## The DOS Machine (Jul 15, 2000)

Sure: *DELTREE [directory path]*

"[directory path]" is the location of the directory you want to delete as in *DELTREE C:\TEMP*. If it is on the root C:\ you can simply type *DELTREE TEMP* and it will work. Just to avoid problems make sure you are at the root prompt (C:\>) before you enter this command. I am not sure if it works on older DOS versions, however.

*-DOSMAN*


----------



## brushmaster1 (Jun 15, 2002)

It all depends on the DOS version. DELTREE was introduced with DOS 6....before that, you had to first delete all the files and then remove the directory (RD)


----------



## Whitestar (Mar 22, 2003)

Im using whatever windows xp uses for the command prompt.


----------



## brushmaster1 (Jun 15, 2002)

In that case, I would think DELTREE should be available. However, I'm not that familiar with XP and what it uses with the command prompt. Perhaps someone else will know....


----------



## Whitestar (Mar 22, 2003)

I tried using deltree, but it says that its not a recognised internal or exteernal command. That probably means that it either cant find the command (unlikely) or the command is an external command and isnt on the computer. If this is the case is it possible to download external commands?


----------



## Lurker1 (Jan 30, 2001)

You can down load the 6 version but it probably won't work on XP. External Dos commands are pretty hung up on having the correct Dos version running. It would most likely give you an wrong DOS version error if you tryed to run it.


----------



## Whitestar (Mar 22, 2003)

I have got 6.22 and im going to reinstall XP anyway. If i install dos first, will it cause problems because dos uses the fat32 file system and XP uses ntfs.


----------



## brushmaster1 (Jun 15, 2002)

Actually, DOS 6.22 uses the FAT 16 file system, and won't even work on FAT 32


----------



## Whitestar (Mar 22, 2003)

smeg. is there a newer version of doss than that?


----------



## brushmaster1 (Jun 15, 2002)

DOS 7 (included with Windows 9x) recognizes FAT32, but I doubt that DOS 7 applets would work with XP.


----------



## kiwiguy (Aug 17, 2003)

Windows XP has no true underlying DOS at all.

The "Command Prompt" available is actually a Windows emulation of DOS. 

Accordingly you may have some issues depending what you are trying to do at the command prompt.


----------



## colman77 (Jun 19, 2002)

WhiteStar,
If you run the command prompt in XP and type help it will give you a list of all the commands it supports... Try RD or RMDIR. Type "RD /?" minus the quotes to get the syntax for the command.


----------



## Krall (Sep 30, 2003)

The best thing to do would be to boot off of dos disk and run your commands from there.

you can get a file to make a dos boot disk from
http://www.bootdisk.com/bootdisk.htm
just click the "DOS 6.22" link, download the file and then put a blank floppy in your disk drive. go to the file you downloaded and run it. It will write to the floppy. when it is done you have a DOS boot disk. with deltree on it


----------



## coderitr (Oct 12, 2003)

Since NT4 Windows has supported the /s switch on the rd (remove directory) command allowing the removal of a non-empty directory.


----------



## DaveBurnett (Nov 11, 2002)

There is a DELTREE in Dos 7. You can use that.
It is DELTREE /Y <directory>
I put it in a batch file with MD <directory> and put the batch file in the Startup folder.


----------



## plejon (Jul 26, 2001)

The following command replaces deltree within XP:

rmdir <dirname> /s or
rd <dirname> /s

This command deletes directories containing files and subdirectories. For more information, just type rd /? in an XP dos box.

So there's no need for deltree anymore


----------

