DiskMAG Volume 1 Number 3 (Dec 1988) : UTILITIES / M2Du368.docs

M2Du 3.68
 - By Greg Browne - 1821 Ocotillo, Alamogordo NM 88310  (505) 437-0807

DirUtil in Modula-2 - 50-1000 files CLI or WB
 Last modified - 8/16/88

 CIS [72250,106]
 Alamo FastKode ROS (505)-437-2280 (24 hr 300-9600 baud)
 New Horizons (505)-437-9117 (7pm-8am 300-2400)

 I am not responsible for anything! Use at your own risk. [See FastDIR]

 This version of the executible is placed in the public domain. FREE!

 Richie Bielack, Martin Taillefer, Matt Dillon, Brett Blevins, Jim Kunzman,
 Chuck Layton, Jeff Francis, Rick Sinars and many others for various reasons.


Accepts arguments in any order, any spacing (from WB use Du.hist commands):
  f = "F"astDir in place.
  t = FastDir "T"emporary - auto turn off after each use.
       Manually turn on EVERY time you want to use it.
  i = "I"ncr max files-per-dir by 50 (multiple 'i' ok).
  d = "D"ecr max files-per-dir by 50 (multiple 'd' ok).
  b = Window to "B"ottom half of SCREEN (if INTERLACED).

STARTUP Du.hist:
Read sample Du.hist file for how to set up some startup commands which
complement, duplicate, and expand the CLItail commands.

LEFT & RIGHT mouse button press & RELEASE over gadget (or name) to register.

Messy & destructive commands need confirmation.  When asked to "HIT [name]
again", USE THE LEFT MOUSEBUTTON.  The right mousebutton will NOT confirm
actions, even those STARTED with the right mousebutton.

Multi-actions interrupt by clicking a gadget (including filewindow) with the
LEFT mousebutton.  Stop is AFTER current pass is complete. When the alternate
pointer is visible, clicks are ONLY interrupts.

Getting files interrupts with a click in the filewindow. If directory has
too many files, you will be warned.

DO, EDIT, & SHOWIFF execute sequentially (prevent disk grinding) until the
last (or only) action. Then the Runcommand (default "run >nil: <nil:") is
used. The Du.hist command #R allows you to change the default.  When these
finish, they do NOT re-read the directory (save more grinding when command
is RUN).  Use hidden 'S' gadget to re-read.

 nnn/tttt  Time 00:00   R-0   Chip nnnnnn  Fast nnnnnnn  Total  nnnnnnnn
---------  ----------   ---   ------------------------------------------
current      24 hr       Which              Memory availability
  files/max    format      history item active

Logs into ram: if run from WorkBench. Logs into Current Dir from CLI.
The #A command in Du.hist allows you to specify initial directory.

Normal AND 'hidden' gadget. Instantly shrink by clicking the open space
below the title bar. Unshrink by clicking hanging space below the title in
the tiny window.  Tiny window movable - remembers where it was.

DEVICE GADGETS: -> df0: df1: df2: dh0: dh1: dh2: dh3: vd0: ram:
LEFT mouse  = put into S with immediate 'GET'.
RIGHT mouse = put into the D gadget.
The default names above can be changed with #0 through #8 in Du.hist.

Click unselected file OR dir and it is "selected". Click a selected name to
unselect it. Most actions need "selected" things to work on.

NOTE: Any/all filenames AND/OR DIRS may be selected at once.
      See "HIDDEN GADGETS" for a 'HOLD' feature in display.

Scroll filename window. If slider is filled, all files and directories are

/\ and \/:
 LEFT mouse  = move 1 file in arrow direction
 RIGHT mouse = move 1 SCREEN in arrow direction

'R' holds a circular list of 20 strings. "R+ R-" scrolls them, and R-nn in
title bar tells which one is in use. Startup looks for a file named Du.hist
in the current directory, and if not found, in the S: directory. FIRST one
found will be used to initialize the strings as explained in the example
Du.hist file. If NEITHER found, all R gadgets will be empty.  The file is
just lines in plain text.  A sample file with instructions is included.

History changes must be typed in AND <ENTER>ed while program waits for
normal gadget activity to be permanent.  Remember, while commands are going
on, the program only looks at gadget selection as an interrupt.  Changes
made during activity, OR ended without <ENTER>ing will be TEMPORARY. Then,
scrolling history +- will return last saved history for that item.
Experiment with it.


All are 255 characters long, but only part of string is seen. To view a
long string, activate the gadget, and use arrows to move through it.

(R)un holds command line info for RUN f<ile>+R.  May also be used alone
 OR as the lead item in a command with highlighted file as tail if RUN
 R+f<ile> used. SEE ALSO HISTORY ABOVE AND THE 'R+ R-' button section.

(S)ource holds name of the current active device or dir. LEFT mouseclick a
 device gadget and its goes here. CLICK, TYPE, AND <ENTER> in this gadget,
 and your entry will be new current device or dir. If access to it fails,
 the program returns to the last good active dir (or to ram: if that fails).
 Click the RIGHT mousebutton IN the BOX and a PARENT command is done.

(D)estination holds the name of the path (filename in some cases) to use
 for certain GADGET functions. Clicking the RIGHT mousebutton IN the box
 backs the name up to its PARENT level (if any).

The Message area at the bottom is NOT a gadget.

Click LEFT mousebutton on LETTER 'R' or 'D' to blank contents of the box.
Click LETTER 'S' for directory re-read of 'S'.
RIGHT mouse on "S" toggles mode and color.
  Black (original color) means re-reads always display from file number 1.
  Green (same as device names) means re-reads try to display from the same
  position as last one. [For comparing similar directories or seeing changes
  in the middle of one.]
RIGHT mouse on the "R" causes the string in the "R" gadget to be scanned.
  If it starts with # it will be evaluated as a setup command, otherwise it
  will be considered a history file, which if opened successfully, will be
  read as a NEW history and command file.

Finally, there is another unmarked gadget mentioned. See FastDIR.

BUTTON GADGETS: (alphabetically - sortof) Gadgets NOT alphabetic on screen

  COPY     (Multifile - consecutive)
Copy any/all selected file(s) to PATH in D (must be a valid device or dir).
Multiple copy supported, copy to specific filename not supported. Checks
PROTECT gadget setting.
 LEFT mouse  = STOP if file status does not match PROTECT gadget.
 RIGHT mouse = SKIP that file and go on.

  COPYALL  (CONFIRMED) (Mass file/directory copy)
Copy entire dir/disk contents, matching tree structure on the fly.  Put
base level source dir name in S and the base dest PATH in D and select
to D, creating directories as it goes. IF destination fills, you will have
a chance to change disks and continue.

 Ex: Copy entire disk (like COPY df0: to df1: all)
       type 'df0:' in S and 'df1:' in D and go.
     Copy devs directory
       Put 'df0:devs' in S and 'df1:devs' (existing OR NOT) in D, and
       start. Creates (if needed) destination directory, copies all files,
       creates df1:devs/printers (if needed) and copies all its files.

Specifically confirmed, DOES NOT check PROTECT setting.

NOTE: If started with RIGHT MOUSE, the dir structure and EMPTY files are
  copied, similar to the old DCAT program. (My personal use - left in place
  in case you can use it.)

Just like COPYALL, BUT with attention to ARC bit of source FILE's protection
bits. If bit is CLEAR (file changed since last set) it WILL copy the file.
If a DIRECTORY bit is SET it doesn't even go into that directory.
 LEFT mouse  = SET source ARC bit after copy done
 RIGHT mouse = DON'T mess with ARC bit

DIRECTORY delete. To work, dir must be selected and EMPTY. ANY/ALL
highlighted directories will be deleted if empty.
 LEFT mouse  = stop if a directory doesn't delete.
 RIGHT mouse = continues EVEN if a directory doesn't delete

  DELETE   (CONFIRMED) (Multifile - consecutive)
FILE delete. Any/all files currently highlighted will be deleted. Message
area shows progress, and delete may be stopped by clicking left mouse
button on any gadget (including filewindow).

Diskcopy 'S' to 'D'  - BOTH MUST BE df0-df3.  Corrects date so DOS won't be
confused.  IS Interruptible.

QUICK WIPE OF disk in 'D'.  MUST BE df0-df3.  Writes fresh root block.

  DO f+R  DO R+f   (Multifile - consecutive)
  ------  ------
RUN/EXECUTE command.
 DO R+f executes the 'R' contents with selected items as a tails.
 DO f+R executes selected items with the 'R' content as a tail.
 If no item is selected, both try the R gadget alone.
Uses DOS Execute (like typing a command at > prompt). Also whether command
is RUN or executed depends on other things (more info in first section).
This is NOT like a script handler 'EXECUTE'.


  EDIT     (Multifile - consecutive)
Start editor with selected FILEname(s) as tail(s). If no file selected,
editor will be RUN with no file. Default name is "dme", but the #E command
in Du.hist sets to your favorite name.

FORMAT disk indicated in 'D'.  MUST BE df0-df3. Names disk "New" and uses
current date.  DOES INSTALL as bootable. IS Interruptible.

  F+ F-
Change #files-per-directory handled by DU.
 LEFT mouse  = increase 50
 RIGHT mouse = decrease 50. (More files = more memory used.)

GETDIR by clicking the RIGHT mouse button over a directory name.

  ------  -----  -----  ----
ASCII/HEX file view/print. Destination of PRINT/HPRINT selected with toggle
gadget PRT: (See TOGGLES/FLAGS section). Multiple hardcopy runs interrupt
the same way as other functions. To scroll up & down in file during screen
output, hold LEFT mouse down in upper or lower ½ of window, or use scroll
bar. To move ONE LINE ONLY in either direction, click RIGHT mouse in the
upper & lower ½ of the window .  Click title bar to quit or interrupt an
individual printout or display. Tabs expanded on 8 columns. NO color
sequences or formfeeds.  Line xx of xxx shown in the title bar.  For PRINT
this is 256 byte blocks NOT lines.

 If PRINT/HPRINT selected with RIGHT mouse, formfeed will be sent after
 each file.

No Gadget.  Program automatically monitors disk insert/remove and changes
to S and D. Redisplays name/free/used for both S & D with every change.

INSTALL disk indicated in 'D'.  MUST BE df0-df3. Writes fresh boot block.

Make dir named in the D gadget (if valid and not existing). If complete
dev:path not given, dir will be made relative to the path in S. Check is
made to insure you are not trying to create a directory with an already
existing name (or over a file).
 LEFT mouse  = DO re-read S when done
 RIGHT mouse = DON'T re-read.

  MOVE     (Multifile - consecutive)
MOVE items to destination (must be path). Tries RENAME. If that fails, and
'item' is NOT a directory, tries copy-and-delete-source. DOES check state
of the PROTECT gadget.
 LEFT mouse  = STOP if item does not match PROTECT gadget status
 RIGHT mouse = SKIP that item and go on.

*WARNING* - A bug in the ram-handler lets you rename a file in ram: to an
 existing name in ram: without a DOS error 203 and leaves you 2 in the same
 directory. Just so you will be aware, I didn't try to trap that.
 (* vd0: also does that! *)

Click RIGHT mousebutton in 'S' or 'D' box for PARENT.

Back up to the root of the current S or D gadget. If this fails with 'S',
return to the last good current directory (or ram: as a last resort).
  LEFT mouse  = Get ROOT of 'S'
  RIGHT mouse = Backup 'D' to its ROOT level

Relabel disk in 'S' to NAME in 'D', both in memory and on disk. Internal.
'D' gadget cannot have ":" or "/" in it.

Rename FIRST selected file OR dir (alphabetically) to Name in the D gadget.
Wherever practical, MOVE is faster.
 LEFT mouse  = re-read directory (since it may be still be there)
 RIGHT mouse = NO re-read (old dropped, new not added even if still there).

  ------ ----- ------- ----- ------ ------ ------
Mass tag operations on all items in a window.
(In some DU's -> TAGALL = ALL   UNTAG = CLEAR)

TAGALL  selects ALL items.
RETAG   after multifile operations reselects items selected before
        (if they remain now).
FLIPTAG reverses all tags.
UNTAG   clears all tags.
OldNew  select based on destination existence.
         LEFT mouse  = tag files which DO exist at dest end (Old)
         RIGHT mouse = tag files which DO NOT exist at dest end (New).
ArcTAG  select items if their ARCHIVE bit is set.
WinTAG  select all items visible in the window.

 LEFT mouse  = 'items' are FILES.       (Except OldNew)
 RIGHT mouse = 'items' are DIRECTORIES. (Except OldNew)

Set filenote of FIRST HIGHLIGHTED file OR dir. Current R gadget content
will be used as comment.  To delete a comment, empty R gadget and SETNOTE
(to null comment).

Show filenote (if any) of FIRST HIGHLIGHTED file. Filenote will be shown in
the message area. If [-no comment-] appears, file has no filenote attached
to it.

Set protection bits on highlighted FILE(s) OR DIR(s).
  LEFT mouse  = work this on FIRST item found highlighted.
  RIGHT mouse = work this on ALL items highlighted.

R gadget must hold letter(s) of bits you want SET. Does NOT consider
CURRENT condition of flags - you must include ALL letters you want set. To
get current status, use SHOPROT. Order of letters does NOT matter. Letters
not present will have their bits CLEARED.

 Protection bits are (UPPER or lower case o.k.):
  A(rchive bit)           Currently RESET each time a file is changed
  R(ead protect bit)      Ignored by DOS now
  W(rite protect bit)     Ignored by DOS now
  E(xecute protect bit)   Ignored by DOS now
  D(elete protect bit)    Prevents deletion when SET

Shows protection bit status on highlighted file OR directory.
Uses current R gadget, so be careful of History items.
 LEFT mouse  = show NEXT highlighted (and unselect)
 RIGHT mouse = scan quickly through ALL highlighted (and unselect)

Picture display. IF Du.hist has #S command, this external program will be
on LEFT mouse and internal show routine will be accessed by RIGHT mouse,
otherwise, both will use internal routine.

Mass directory-and-related-files delete. Works two ways.

1) If a directory name IS highlighted when ZAPALL is selected, it assumes
   you want to delete that directory AND ALL FILES AND SUBDIRECTORIES IN IT.

2) If NO directory name highlighted, it assumes you want to delete CONTENT
   of the directory (or device) in the S gadget, including ALL files and
   subdirectories, BUT NOT directory itself. (This leaves an empty, but
   existing, directory.

1) Delete all files in df1:devs (but not df1:devs itself). Put df1:devs
   in S and go. This leaves an empty df1:devs as the S directory.
2) Delete its files AND IT, TOO. Put 'df1:' in S and select 'devs'
   with one click. Then hit ZAPALL twice (once to select ZAPALL, once to
   CONFIRM ZAPALL), and all the files and directories in 'devs' will be
   deleted, then devs will be deleted (unless it is ASSIGNed to devs:).

Gives message area progress reports. Deletes files alphabetically backward,
recursing into directories as encountered.  Watch and see.

  R+ R-
 LEFT mouse  = +
 RIGHT mouse = -

Takes first highlighted item and ADDS it to 'D' gadget with / if needed.

First does D+f->D and then does a GetDir if the item is a directory.
Handy for adding a path to destination AND getting a directory all at once.

  f->R  f->D
  ----  ----
Move FIRST highlighted file (OR directory) into indicated gadget.

  R->S  R->D  etc.
  ----  ----
Copy current gadget contents around. If R involved, affected history item
is updated. IF S involved, it is treated like a new entry.

  R<->S  etc.
Two-way swaps of gadget content. S<->D is the old SWAP command. If S is
involved, it will be treated as though typed in fresh. If R gadget is
involved, affected history item is updated.


A hidden gadget in the little square area between the device names and
the toggle flags.  This installs/removes the FastDIR (block access)
routines.  They are faster, but come at a high price.  When active a
letter 'F' will appear in that space.

(not too nice on a hard disk).  ESPECIALLY DURING ARC/ZOO/UNARC it
is important to remove them. After you destroy a good disk or two,
you will remember.    CONSIDER YOURSELF WARNED!!!      Greg Browne

Indicates protection used for files at destination end of COPY and MOVE.
(Not honored by COPYALL, COPYif, or ZAPALL, which must be confirmed.)

 1. PROTECT - Don't continue if same name file EXISTS at destination.
 2. ERASE   - Don't care about file of same name at destination.
 3. REPLACE - Don't continue UNLESS file of same name EXISTS at destination.

Indicates what type of names S gadget will use.

 1. DevNAME -  df0:??  df1:?? etc. will be used.
 2. VolNAME -  disk names (MyVol:??) will be picked up.

May be useful where one drive swaps are involved.

Drawback in VolNAME mode. ASSIGNed names like devs: can't be used. Program
assumes you want Volume Name of the disk that ASSIGNed device is on and
goes to the root expressed as volume name.

Sets what to display about files. Changes when hit.

 1. SIZES - byte file size will show.
 2. DATES - creation dates will show.

Select date to put on copied files.

 1. SysDATE - current system date goes on copies.
 2. OldDATE - creation date of source file goes on copies.


Showing item is destination for PRINT/HPRINT.
 [SER: can be changed by command #O in Du.Hist.]