Dec 132017
 
ZAPDIR will Kill a directory and all of its sub-directories including the files contained within them. Powerful.
File ZAPDIR.ZIP from The Programmer’s Corner in
Category File Managers
ZAPDIR will Kill a directory and all of its sub-directories including the files contained within them. Powerful.
File Name File Size Zip Size Zip Type
ZAPDIR.COM 272 201 deflated
ZAPDIR.TXT 4527 1924 deflated

Download File ZAPDIR.ZIP Here

Contents of the ZAPDIR.TXT file



ZAPDIR: REMOVE DIRECTORIES
by Scott Pakin


Why ZAPDIR?
-----------

One problem hard disk users sometimes face is removing unwanted
directories. DOS won't let you remove a directory that has any content -- even
a single file or subdirectory. DOS requires you to go the the lowest level in
the directory tree, erase all the files in it, go up a level, remove the
subdirectory (repeating for any other subdirectories), erase all the other
files, go up a level, and then, finally, remove the original directory you
wanted to get rid of.

This is a real hassle, but it's even worse when you have hidden files or
read-only files (that some copy-protected programs leave behind). When you
issue a DIR command, DOS might tell you that there are no files in the
directory, but when you use RD (or RMDIR), you'll get a "Directory not empty"
error message. This usually means you have to use an attribute-changer (such
as ALTER or MARK) to make the files "normal."

Let's say your directory tree looks like this:

\
AUTOEXEC.BAT
CONFIG.SYS
ZAPDIR.COM
WIPEDIR.BAT
\VALUABLE
SPREAD.EXE
DATABASE.EXE
WORDPROC.COM
SPELLCHK.COM
WORDS.ABC
\GARBAGE
WORTHLES.JNK
WASTEOF.$$$
\HARMFUL
CLEANDSK.EXE
CRASH.COM
GARBLE.EXE
NUISANCE.HAH
VIRUS.COM

To get rid of directory GARBAGE, you have to type the following:

DEL GARBAGE\HARMFUL\*.*
RD GARBAGE\HARMFUL
DEL GARBAGE\*.*
RD GARBAGE

If \GARBAGE\HARMFUL\NUISANCE.HAH is a read-only file, it will prevent you
from removing \GARBAGE\HARMFUL and thus \GARBAGE, unless you use an
attribute-changer to make it a normal file.

ZAPDIR to the rescue! Using ZAPDIR, you need not delete files or
subdirectories. You just type:

ZAPDIR GARBAGE

to remove the sample directory. ZAPDIR even erases NUISANCE.HAH, although it's
a read-only file. This saves a lot of time and bother.


Limitations
-----------

ZAPDIR has a few limitations, none that make it more difficult to use than
a sequence of DELs and RDs. First, you cannot provide a drive name; you must
use the default drive. Second, you can't use the "\" character. This means
you have to be exactly one level above the directory you want to remove. (In
this example, you'd have to be in the root directory.) Third, removing
non-empty directories leaves one lost chain for every file or directory erased.
These lost chains can easily be removed by using CHKDSK with the /F option
immediately after using ZAPDIR.


How do I use ZAPDIR?
--------------------

WIPEDIR.BAT, shown below, is a batch file which invokes ZAPDIR. To invoke
WIPEDIR, type:

WIPEDIR directory

First, WIPEDIR tells you which directory you told it to erase. Then, it
gives you a warning message, reminding you that removing a non-empty directory
will obliterate all files and subdirectories belonging to it. If this is what
you want to do, press a key. Otherwise, press Ctrl-Break. Next, ZAPDIR is
used to remove the directory. If ZAPDIR is successful, CHKDSK will be invoked
with /F. When CHKDSK asks if you want to "convert lost chains to files,"
WIPEDIR will automatically answer "no."

N
ECHO OFF
CLS
ECHO Name of directory to remove: %1
ECHO (If you didn't provide a directory name, press Ctrl-Break and start over.)
ECHO --------------------------------------------------------------------------
ECHO WARNING! This command will remove the above directory regardless of
ECHO whether it is empty or not. All subordinate directories and files (even
ECHO hidden, read-only, etc.) will be erased. To cancel this command, press
ECHO Ctrl-Break. Otherwise,
PAUSE
ZAPDIR %1
IF ERRORLEVEL 1 GOTO THEEND
CHKDSK/F < WIPEDIR.BAT
:THEEND


What do I do if I find ZAPDIR useful?
-------------------------------------

Relax. I'm not asking for money. However, if you find ZAPDIR useful, if
you can't figure out how you lived without it, if you find a use for it other
than erasing unwanted, non-empty directories, if you have any questions or
suggestions, I'd appreciate it if you sent me a postcard. Send it to:


Scott Pakin
6007 N. Sheridan Rd.
Chicago, IL 60660




 December 13, 2017  Add comments

Leave a Reply