*------------------------------------------------------------------*
|    NAME:     D (DIR)                                             |
|    FUNCTION: Sorted File Directory Program                       |
*------------------------------------------------------------------*

DIR  is  fine  if  you  only want a quick look at a small directory.
There are any number of sorted directory programs around,  and  this
is  yet  another one, but with a difference.  Since I am basically a
systems man, I write my programs with  the  aim  of  making  systems
maintenance  an easier task.  This program has the usual FILE, TYPE,
SIZE and DATE sorts, but also allows REVERSE order sorts (just think
of the advantages!) and can selectively  show  DIRECTORY  names  and
HIDDEN files.  Attributes [r,h,s] are also shown for each file. File
sizes  are  in  bytes  up  to  99999,  then to 99999K and finally in
Megabytes.  Disk used and free is shown.   Options  include  showing
file  sizes  in  Kilobytes only or in Cluster sizes, not sorting the
files at all (ie they are shown in the same order as  found  in  the
directory) or showing in WIDE form (3,4 or 5 columns).  Subdirectory
searching  is  also  supported.   What's more, all dates are genuine
Aussie format if you specify COUNTRY=061 in  your  CONFIG.SYS  file.
Options can be cloned into D.COM.

Options can be found by typing D/?


Usage: D [/options] [path][filespec]

Switch Options:

/A - All entries (files and subdirectories)
By default, directory entries  are  not  displayed.   Using  the  /A
switch  option  includes  them  in the listing. They are marked with
<dir> in the filesize field.

/C - CLUSTER file sizes
The default file display mode shows file sizes to the exact byte for
files less than 65536 bytes, and to the next Kilobyte for  files  of
64Kbytes  or greater.  The /C switch option forces the file sizes to
be displayed in units of the disk cluster size.  It also  shows  the
cluster parameters for the disk at the end of the last display page.

/D - File DATE/time sort
The  default  sort  is by filename.filetype (i.e.  the full filename
and type are treated as a single string). The /D switch option  adds
the  file  date/time  to  the  sort criteria. Oldest files are shown
first under normal sort.  The order can  be  reversed  with  the  /R
switch option.

/E - EXPAND extension toggle
This option toggles the option for the  handling  of  conversion  of
filenames from "*" to "*.*"  By default, /E is ON. i.e. filenames of
the form "x*" become "x*.*"  To specify non-extension filenames when
the /E option is in use, use the form "x*."

/Fx- FILL character for attributes
This  option  allows  the  blank  filler  character for non-selected
attributes to be changed to a printable  character.   The  character
immediately  following  the /F replaces the space normally used.  By
using this option in conjunction with  the  /O  cloning  option  can
permantly  set the filler character.  Suggestions for the filler are
'-' or <250>.  To enter a non-standard keyboard character  (such  as
<250>,  which  is  a  small centred dot) hold down the <ALT> key and
enter the decimal number on the keypad.

/G - GROUP Directory names first
This  option  allows  subdirectories  to  be grouped first on output
instead of scattered in desired  order  throughout  the  list.   (/G
option cloning is suggested and is default on distribution)

/H - Add HIDDEN & System files
Files  tagged  as  Hidden  and/or System are not normally displayed.
The /H switch option adds these to the directory listing.

/K - KBYTE file sizes
This option displays the files in Kbytes,  rather  than  bytes,  for
files  less  than  65536  bytes  in  length.   The  /C switch option
overrides this option.

/L - Lower case filenames
Subdirectories and Filenames are normally shown in upper case.  This
option forces them to be shown in lower  case.   Note:  this  option
does not affect the Volume Name or the Directory Path.

/N - NO Sort of directory
This option gives a directory listing in the file  order  stored  in
the directory.  (This is the order that the MSDOS command DIR uses.)
None  of  the  sort  switch options (D,T,S,R) will be active if this
mode is chosen.

/O - OPTION save
Allows options to be permanently stored in  D.COM,  thus  permitting
it   to  be  customised  for  personal  preference.   e.g.  to  show
subdirectories and  hidden  files  by  default,  enter  the  command
D/a/h/o Most options are complementing switches, so they may be used
to  reverse  a  default setting, either during option save or normal
use.  For example, if the above option command had been  used,  then
D/a *.* will not show subdirectories, but still show hidden files.

NOTE: This command requires  D.COM  to  be  executed  from  its  own
directory  or  found  in  an  APPEND path.  If it exists in multiple
subdirectories, only the first instance will be updated.  Thus it is
possible to have multiple copies of D.COM which have default options
to suit their specific application.

See also note on setting an environment string.

/Q - Quick mode (non-stop display)
The display normally stops at the end of each screen.  The /Q option
disables this mode.  The /P option automatically sets this option.
This mode no longer page formats the output.

/R - REVERSE order sort
The  /R  switch option reverses the order of sorting.  The following
table shows the NORMAL  and  REVERSE  sort  order.   Note  that  the
directory  is  always sorted by filename.typ first.  Where more than
one sort is specified, the program will sort in the order  filename,
filetype, date and filesize.

SORT SWITCH     NORMAL              REVERSE
      none      0..9,A..Z           Z..A,9..0
      /T        nil..ZZZ            ZZZ .. nil
      /D        oldest..newest      newest..oldest
      /S        smallest..largest   largest..smallest

/S - SUBDIRECTORIES searched
This  option  allows  D  to  search  the path (if specified) and all
subdirectories below it.  Each subdirectory  is  treated  separately
for   the   purposes  of  sorting  and  display.   The  disk  volume
information  is  shown  at  the  top  of  the  first  listing,  only
subdirectories  having  information  to  display  are presented, and
paging (if not disabled by either /P or /Q options) is  modified  to
handle multiple lists.  The  paging  algorithm  will  allow  several
lists  to  be  shown  on the same page.  An inter-directory pause is
added if it will cause the current page to overflow.

/T - File TYPE sort
Sort  files  according  to  filetype.   Within  each  filetype,  the
filenames are alphabetically sorted in the same order. Files without
any  filetype  suffix  are listed first.

/W - WIDE display mode
Does not  display  date/time/size  information,  but  displays  four
columns  of  filenames  only,  sorted  as  specified  by  the switch
options.

/Z - File SIZE sort
Sort  files  according to size (in bytes) of the files. The smallest
files are listed first in a normal order sort.

/B:dd/mm/yy - newest date "Before"
This  option  allows  a  newest  date  to be specified.  Any file or
sub-directory of newer date will not be displayed.  Format  for  the
date  must  be  /B:dd/mm/yy  and  have  a  trailing  space  if other
parameters follow.  e.g. D /B:31/12/92 *.asm

/D:dd/mm/yy - oldest date "Dated"
This option allows an oldest date to  be  specified.   Any  file  or
sub-directory of earlier date will not be displayed.  Format for the
date  must  be  /D:dd/mm/yy  and  have  a  trailing  space  if other
parameters follow.  e.g. D /D:1/1/92 *.asm
When combined with the /B:date option, this allows display of only a
restricted date range.  e.g. D /B:31/12/92 /D:1/1/92 *.asm will only
list *.ASM files with date ranges in 1992.

This option does not affect the status of the /D date sort option.

/1 - 1 column Wide mode
The display will be automatically selected for "Wide" mode operation
and show 1  column.   Each  file  entry  will  indicate  attributes,
filesize   and  date/time.   Shows all attribute bits. Displays file
sizes in bytes, irrespective of file size.

/2 - 2 columns Wide mode
The display will be automatically selected for "Wide" mode operation
and  show  2  columns.   Each  file  entry will indicate attributes,
filesize and date/time. This is the normal mode if cloning  has  not
altered the default options.

/3 - 3 columns Wide mode
The display will be automatically selected for "Wide" mode operation
and  show  3  columns.  Each file entry will indicate attributes and
filesize but not date/time.

/4 - 4 columns Wide mode
The display will be automatically selected for "Wide" mode operation
and  show  4 columns.  Each file entry will indicate attributes, but
not filesize or date/time.
Note: subdirectories will not be marked with <DIR>

/5 - 5 columns Wide mode
The display will be automatically selected for "Wide" mode operation
and show 3 columns.  Only the filename for each entry will be shown.
Note: subdirectories will not be marked with <DIR>




NOTE: When /1 .. /5 mode is cloned, it will also  clone  the  "Wide"
mode  option  by  default.   To  clone  without "Wide" mode default,
select the /W option after the /n option.

      example: D /3/w/o

This will clone to 3 column "Wide" mode, but default to normal mode.
Then, when /W mode is selected, display will be in 3 columns.


SORT SEQUENCE OPTIONS:

Only  the  last  specified  sort sequence option (/D /N /T /Z /S) is
used  i.e. each instance overrides any previous instance on the same
command line or in the cloned mode.


Note:  D  now  automatically detects the number of display lines and
changes the number of lines per paged display to suit.  Each display
page shows 5 lines less than the lines per page.  (This algorithm is
slightly modified when using the /S option)

Note: An alternative to using the /O cloning option is  to  set  the
switch   options  in  the  environment  string  "D_CMD",  either  in
AUTOEXEC.BAT or as a temporary definition.

For example, SET  D_CMD=/A/H/L  will  append  the  switches  to  all
command  tails.   Thus  D/W  *.COM will become D/W *.com/A/H/L.  The
string D_CMD can be removed at any time by typing SET D_CMD=

Author:         Howard Harvey (hjh@gwd.dsto.gov.au)
Release date:   5/MAY/94
