You are currently offline, waiting for your internet to reconnect

How to Delete the Contents of a Directory in One Step

This article was previously published under Q32497
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
SUMMARY
If you try to delete the entire contents of a directory, MS-DOS prompts youto verify the operation. While this helps protect you against inadvertentlyerasing a large number of files, it also forces you to go through two stepsto perform a single operation. The experienced MS-DOS user can place thefollowing command in a batch file in order to make available the option ofdeleting 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 currentworking directory by invoking the batch file as follows:
delall .
NOTE: This example may want to include more error checking, since invokingthis batch file and forgetting to provide the %1 argument would delete allof 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.
6.22 2.x 3.x 4.00 5.00 6.00 6.20
Properties

Article ID: 32497 - Last Review: 11/16/2006 05:37:35 - Revision: 2.1

  • Microsoft MS-DOS 2.11 Standard Edition
  • Microsoft MS-DOS 3.1
  • Microsoft MS-DOS 3.2 Standard Edition
  • Microsoft MS-DOS 3.21 Standard Edition
  • Microsoft MS-DOS 3.3 Standard Edition
  • Microsoft MS-DOS 3.3a
  • Microsoft MS-DOS 4.0 Standard Edition
  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 5.0a
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition
  • KB32497
Feedback