How to Delete the Contents of a Directory in One Step (32497)
The information in this article applies to:
• Microsoft MS-DOS operating system 2.11
• Microsoft MS-DOS operating system 3.1
• Microsoft MS-DOS operating system 3.2
• Microsoft MS-DOS operating system 3.21
• Microsoft MS-DOS operating system 3.3
• Microsoft MS-DOS operating system 3.3a
• Microsoft MS-DOS operating system 4.0
• Microsoft MS-DOS operating system 5.0
• Microsoft MS-DOS operating system 5.0a
• Microsoft MS-DOS operating system 6.0
• Microsoft MS-DOS operating system 6.2
• Microsoft MS-DOS operating system 6.21
• Microsoft MS-DOS operating system 6.22
This article was previously published under Q32497
SUMMARY
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:
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:
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.
Modification Type: |
Major |
Last Reviewed: |
5/12/2003 |
Keywords: |
KB32497 |
|