Article ID: 32497 - View products that this article applies to.
This article was previously published under Q32497
If you try to delete the entire contents of a directory, MS-DOS prompts you to verify the operation. While this helps protect you against inadvertently erasing a large number of files, it also forces you to go through two steps to perform a single operation. The experienced MS-DOS user can place the following command in a batch file in order to make available the option of deleting the contents of directory in one step:
echo y | del %1\*.*If the above line is placed in a batch file called, for example, DELALL.BAT, you can then tell MS-DOS to delete all the files in the current working directory by invoking the batch file as follows:
delall .NOTE: This example may want to include more error checking, since invoking this batch file and forgetting to provide the %1 argument would delete all of the files in the root directory.
If you are using MS-DOS 6 or later, you can simply use the DELTREE program. For more information on DELTREE, type help deltree at the MS-DOS 6.x command prompt and then press ENTER.
Article ID: 32497 - Last Review: November 16, 2006 - Revision: 2.1
Contact us for more help
Connect with Answer Desk for expert help.