home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / dirutl / zapdir.arc / ZAPDIR.TXT < prev   
Text File  |  1980-01-01  |  5KB  |  127 lines

  1.  
  2.                           ZAPDIR:  REMOVE DIRECTORIES
  3.                                 by Scott Pakin
  4.  
  5.  
  6. Why ZAPDIR?
  7. -----------
  8.  
  9.      One problem hard disk users sometimes face is removing unwanted
  10. directories.  DOS won't let you remove a directory that has any content -- even
  11. a single file or subdirectory.  DOS requires you to go the the lowest level in
  12. the directory tree, erase all the files in it, go up a level, remove the
  13. subdirectory (repeating for any other subdirectories), erase all the other
  14. files, go up a level, and then, finally, remove the original directory you
  15. wanted to get rid of.
  16.  
  17.      This is a real hassle, but it's even worse when you have hidden files or
  18. read-only files (that some copy-protected programs leave behind).  When you
  19. issue a DIR command, DOS might tell you that there are no files in the
  20. directory, but when you use RD (or RMDIR), you'll get a "Directory not empty"
  21. error message.  This usually means you have to use an attribute-changer (such
  22. as ALTER or MARK) to make the files "normal."
  23.  
  24.      Let's say your directory tree looks like this:
  25.  
  26. \
  27.     AUTOEXEC.BAT
  28.         CONFIG.SYS
  29.         ZAPDIR.COM
  30.         WIPEDIR.BAT
  31.     \VALUABLE
  32.             SPREAD.EXE
  33.             DATABASE.EXE
  34.         WORDPROC.COM
  35.                 SPELLCHK.COM
  36.                 WORDS.ABC
  37.     \GARBAGE
  38.             WORTHLES.JNK
  39.                 WASTEOF.$$$
  40.                 \HARMFUL
  41.                     CLEANDSK.EXE
  42.                         CRASH.COM
  43.                         GARBLE.EXE
  44.                         NUISANCE.HAH
  45.                         VIRUS.COM
  46.  
  47.      To get rid of directory GARBAGE, you have to type the following:
  48.  
  49.     DEL GARBAGE\HARMFUL\*.*
  50.         RD GARBAGE\HARMFUL
  51.         DEL GARBAGE\*.*
  52.         RD GARBAGE
  53.  
  54.      If \GARBAGE\HARMFUL\NUISANCE.HAH is a read-only file, it will prevent you
  55. from removing \GARBAGE\HARMFUL and thus \GARBAGE, unless you use an
  56. attribute-changer to make it a normal file.
  57.  
  58.      ZAPDIR to the rescue!  Using ZAPDIR, you need not delete files or
  59. subdirectories.  You just type:
  60.  
  61.     ZAPDIR GARBAGE
  62.  
  63. to remove the sample directory.  ZAPDIR even erases NUISANCE.HAH, although it's
  64. a read-only file.  This saves a lot of time and bother.
  65.  
  66.  
  67. Limitations
  68. -----------
  69.  
  70.      ZAPDIR has a few limitations, none that make it more difficult to use than
  71. a sequence of DELs and RDs.  First, you cannot provide a drive name;  you must
  72. use the default drive.  Second, you can't use the "\" character.  This means
  73. you have to be exactly one level above the directory you want to remove.  (In
  74. this example, you'd have to be in the root directory.) Third, removing
  75. non-empty directories leaves one lost chain for every file or directory erased.
  76. These lost chains can easily be removed by using CHKDSK with the /F option
  77. immediately after using ZAPDIR.
  78.  
  79.  
  80. How do I use ZAPDIR?
  81. --------------------
  82.  
  83.      WIPEDIR.BAT, shown below, is a batch file which invokes ZAPDIR.  To invoke
  84. WIPEDIR, type:
  85.  
  86.     WIPEDIR directory
  87.  
  88.      First, WIPEDIR tells you which directory you told it to erase.  Then, it
  89. gives you a warning message, reminding you that removing a non-empty directory
  90. will obliterate all files and subdirectories belonging to it.  If this is what
  91. you want to do, press a key.  Otherwise, press Ctrl-Break.  Next, ZAPDIR is
  92. used to remove the directory.  If ZAPDIR is successful, CHKDSK will be invoked
  93. with /F.  When CHKDSK asks if you want to "convert lost chains to files,"
  94. WIPEDIR will automatically answer "no."
  95.  
  96. N
  97. ECHO OFF
  98. CLS
  99. ECHO Name of directory to remove: %1
  100. ECHO (If you didn't provide a directory name, press Ctrl-Break and start over.)
  101. ECHO --------------------------------------------------------------------------
  102. ECHO WARNING! This command will remove the above directory regardless of
  103. ECHO whether it is empty or not. All subordinate directories and files (even
  104. ECHO hidden, read-only, etc.) will be erased. To cancel this command, press
  105. ECHO Ctrl-Break. Otherwise,
  106. PAUSE
  107. ZAPDIR %1
  108. IF ERRORLEVEL 1 GOTO THEEND
  109. CHKDSK/F < WIPEDIR.BAT
  110. :THEEND
  111.  
  112.  
  113. What do I do if I find ZAPDIR useful?
  114. -------------------------------------
  115.  
  116.      Relax.  I'm not asking for money.  However, if you find ZAPDIR useful, if
  117. you can't figure out how you lived without it, if you find a use for it other
  118. than erasing unwanted, non-empty directories, if you have any questions or
  119. suggestions, I'd appreciate it if you sent me a postcard.  Send it to:
  120.  
  121.  
  122. Scott Pakin
  123. 6007 N. Sheridan Rd.
  124. Chicago, IL    60660
  125.  
  126.  
  127.