                 NDIR - The Ultimate Color Directory Program

                              Written by:
                         Daniel D. Miller
                         4835 Coco Palm Drive
                         Fremont, CA  94538

                     Email: derell.licht@sbcglobal.net
                     Web:   http://pages.sbcglobal.net/derell.licht

The NDIR utility is released as Freeware, though I retain the copyrights 
on all included programs.  Please feel free to distribute it anywhere that 
you wish!!  This package may be included freely in CDROM and online
archives, as long as all included files are retained in the package.

***************************************************************************

                        NDIR - The directory lister.

This program is a color directory lister with many options.  In addition
to the standard file-display options, it also offers special display
options to:

   ->  Display drive summaries for all disk drives in your system
   ->  Display a complete, recursive directory tree that shows summary
       information for all subdirectories on a drive.  *NO OTHER*
       color directory lister shows as much information in the TREE
       view as NDIR does!!
   ->  Batch mode: enables user to create batch files from lists
       of filenames in a directory.

The NDIR software package contains several utilities:

1. NDIR16.EXE
   This is the 16-bit version of NDIR.  It's significantly quicker than the
   32-bit version, but it doesn't support long filenames under WinNT.
   It also can be confused by certain special characters in Win9X long
   filenames.  This is rarely an issue, though.  Also, since it's a 16-bit
   program, it's limited to available real-mode memory (remember that??),
   so if you try to read *alot* of data, it may run out (try listing a 
   directory tree from the root of a 30GB drive!!).

2. NDIR32.EXE
   This is the 32-bit version of NDIR.  It properly handles long filenames
   under WinNT.  It's significantly slower than NDIR16, but unless you're
   running under old, slow CPUs such as my old AMD K6-2/350, you won't likely
   be able to see the difference.  I haven't been able to fool it by putting
   odd characters in long filenames.

3. NDIRH.EXE
   This is the new HTML version of NDIR.  Rather than displaying its results
   on the current console, it will write it to a file in your official
   temp directory, and then will spawn a copy of your default browser to
   display the output.  This can be useful if you're displaying more than one 
   screenful of data, such as when displaying the directory tree for a large
   directory structure.  Try it on the root directory of a large drive, and
   see all the results!!.  NDIRH also lets you specify which fonts to use
   for the various display elements, as well as scaling factors for each.

   Be warned that NDIRH was written for IE5 or above; neither Netscape nor
   Opera seem to handle all of the style-sheet variables properly...

***************************************************************************

                                Installation

The only installation required by NDIR is to place *.EXE and NDIR.INI
somewhere in your path, so they can be located when you run them from
a DOS prompt.

***************************************************************************

- Program configuration

Much has changed in this new revision of NDIR.  Previous users of the program
are probably wondering where NDIRMOD, the old configuration utility, went to.
The answer is, its gone, because IT'S NO LONGER NEEDED!!

Ndir is now configured via a configuration file, called NDIR.INI.  
*All* of the executables use the same configuration file.  A default INI
file is included with this distribution; I recommend copying the INI file and
the appropriate executable files to a directory that is in your path. 
C:\WINDOWS (or C:\WINNT) should work fine.

When NDIR first executes, it searches for NDIR.INI.  The search method is:

1. search the current subdirectory

2. If not found, search the directory where the executable file was located.

3. If still not found, create a default NDIR.INI in the location where the
   executable file was located, and then loads that file.

One advantage of this search method is that you can have a default file with
your normal settings, but if you want "special handling" in a certain 
directory, you can make a copy of the INI file there, and put different 
settings in it.  For example, you might want /2 normally, but want /6 in 
directories with many files.  NDIR.INI lets you easily do this!!

Another advantage of using INI files is that you'll never lose your settings 
if I revise the program, as has periodically happened in the past.  There's 
also no need to do the NDIRMOD trick to copy configurations from one program 
to another.  The INI format is guaranteed to remain valid in the future, 
regardless of what I do to internal data formats.

- NDIRH configuration

The NDIRH html file lister uses some additional entries in NDIR.INI.
These options allow the user to specify which fonts are used for various
displays.  The following options in NDIR.INI are specific to NDIRH:

;#####################################################
; special font-file specifications for NDIRH.
; The other NDIR versions should ignore these lines.
;#####################################################

;  Font used for displaying the NDIR logo
logo_font=caligula
logo_size=150  ; percentage of standard size to use for display

;  Font to use for display file names and data
normal_font=terminal
normal_size=100

;  Standard header font
header1_font=Cloister_Black-Light
header1_size=150

;  Extra header font (currently only used for directory tree)
header2_font=bodacious-normal
header2_size=140

;  Used to display directory data in the directory tree.
;  This font should support the old MSDOS line-drawing characters,
;  and probably should also be non-proportional.
tree_font=MS Linedraw
tree_size=120

;#####################################################
;  End of special NDIRH variables
;#####################################################

The font name can be any installed font; i.e., any font which is displayed in 
the Font display within Control Panel.  The font name should be spelled 
exactly as displayed in the Font dialog; I don't know whether it's 
case-sensitive.

The size variable is a percentage of the standard size at which Windows would 
display the font.  size=100 represents 100%, you can use any percentage you 
wish; there's no requirement to stop at 100%.

***************************************************************************

History of changes:

See revisions.txt for detailed revision history.

The -o option now has a required following numeric digit (i.e., it is 
specified as -o0, -o1, or -o2). More options will probably follow this 
pattern in the future, in order to increase the flexibility of the program.  
As a result, when using a numeric switch as a normal switch character, it is a 
good idea to place it FIRST in a group of switches, to avoid ambiguity in 
interpretation.  In other words, if you want a single-column display, it's 
better to specify -1tr rather than -tr1, in case I later add a numeric option 
to the -r switch!!

Converted both programs to use an INI file for configuration.  NDIRMOD has now 
been eliminated, and in fact won't work at all.

There's still a small problem with determining the cluster size on
network drives from the 32-bit programs; I haven't yet figured out
that trick.  

***************************************************************************
                Handling System/Hidden/Readonly files

NDIR can now display S/H/R files with a background color selected by
the user.  The foreground color is determined by the file attribute,
with the BRIGHT bit set, and a background color which is specified
by the user.  The following table lists the foreground colors for various 
file attributes:

        S  H  R         foreground color
      =================================================
        0  0  0      determined by file extension
        0  0  1      Bright Blue
        0  1  0      Bright Green
        0  1  1      Bright Cyan
        1  0  0      Bright Red
        1  0  1      Bright Magenta
        1  1  0      Bright Brown (Yellow)
        1  1  1      Bright White

***************************************************************************

         WHAT DOES NDIR DO THAT EVERY DIR LISTER DOESN'T ? ?

Here are some of the features of NDIR, a summary of which can be
obtained by typing NDIR -? :

- Long-filename support (MSDOS 7.00+ and NTFS)

- FAT32 and NTFS support.

- Configuration via INI file(s).

- Full color file display.

- List executable files only (.BAT, .COM, .EXE) 

- Full control over display format 
  (pause-on-full-screen, clear-screen-before-listing, 
   select number of columns and amount of file info shown).

- File exclusion (list all files EXCEPT *.ult, for example).

- Full directory TREE, showing size of current directory
  as well as current directories PLUS subdirectories.

- Show ALL files, including read-only, hidden and system files.

- A separate configuration program, for customizing default options,
  as well as all color and extension settings.

- EGA 43-line support (50 lines on VGA).

- A "batch" mode which can assist you in creating batch files.


     WHAT DOESN'T NDIR DO THAT EVERY DIR LISTER DOES OR DOESN'T ? ?

Functions that are NOT supported (because I ran out of time before other
projects developed), but may be added if interest is shown, are:

- Compressed FAT32 drives are not reported correctly.  This will be added 
  if anyone tells me they are using disk compression; with huge disks so 
  cheap, I'm assuming nobody is paying the performance penalty.

- Support for global subdirectories; i.e., search for files across all
  subdirectories under current default. The framework for implementing 
  this is in place, but it would take a fair amount of work to finish 
  it, and I'm waiting to see if anyone cares.

- Ability to search for files with only a certain attribute or combination
  of attributes.

- Anything else that I didn't think of, and nobody's requested.

***************************************************************************

                 WHO ARE YOU ? ?  (who-who. who-who.)

I am a Software Engineer, living in Fremont, CA.  I started out as a
digital hardware engineer, but discovered that software is more fun!!!
I have professional experience with C (mostly), numerous assemblers, 
PASCAL, Visual Basic (but I got better), and DBASE III (don't laugh).  

NDIR was written in MS C++ version 8.00 and MASM 6.13, with assistance from 
the excellent Spontaneous Assembly extended libraries.  These excellent 
libraries, unfortunately, are no longer available commercially, more's the 
loss.

NDIR32 and NDIRH were written in Visual C++ V6, with no after-market libraries 
at all...

***************************************************************************

NDIR Command-Line switches
--------------------------

This is a list of the command-line switches supported by NDIR.
(Many of these options do *not* apply to NDIRH)

This list can also be obtained by typing 'NDIR /?'

USAGE:  NDIR <filespecs> -options or /options !<exclusions>
 
 OPTIONS                      FUNCTIONS
   -a *     List ALL files (hidden, system, read-only, etc.).
   -c *     Clear screen before listing.
   -p *     Pause on full screen.
   -m *     Minimize size of header and footer.
   -w *     Use special colors for system/hidden/readonly files.
   -d *     Display directory TREE (work with -s, -n (default), -r).
   -e       Sort by extension.
   -n        "   by name.
   -s        "   by file size, smallest first.
   -t        "   by Date, oldest first.
   -z        "   by DOS order (no sort).
   -r *     Reverse normal sort order.
   -1       Display one column,  with name/size/date/attr.
   -2          "    two   "   , with name/size/date.
   -3          "    three "     (short-filename form only)
   -4          "    four  "   , with name/size.
   -6          "    six   "   , with name only.
   -i       Display drive summary for all drives in system.
   -?       Display HELP screen.
   -x *     List executables only (.EXE,.COM,.BAT).
   -l *     Toggle long-filename enable flag (MSDOS 7.00+ only)
   -k *     Toggle color mode. (non-color mode is redirectable)
   -j *     Use standard ASCII (for redirection). (forces -k)
   -5 *     Switch to EGA 43-line/VGA 50-line mode.
   -o *     Display LAST_MODIFY (default) or FILE_CREATE date/time.
   -oN      Date/Time display: 0=LastWrite (default), 
                               1=LastAccess, 
                               2=FileCreated
   -u *     List filenames in UPPERCASE.
   -v       Display distribution status and author information.
   -g *     List directories FIRST.
   -h *     List files horizontally.
   -f *     List files only (No directories).
 
   -b       Batch mode;  files listed in one column.
            (This format can be redirected to a batch file)
   ["string"  specifies a string BEFORE each filename (Batch mode)
   ]"string"  specifies a string AFTER  each filename (Batch mode)
 
NOTE: items with a * after the flag are TOGGLES
 
***************************************************************************
                     
NOTES on using command-line switches:
-------------------------------------
NDIR's functionality can be modified in three ways:

1. Type NDIR <options> as documented above.

2. Modify the NDIR.INI file as required.

3. Use the NDIR ENVIRONMENT VARIABLE to specify NDIR options.
   This probably isn't worth the effort anymore, since editing an INI file
   is just as easy.  In fact, it hasn't been tested in a *long* time.
   In any case:

   At the DOS prompt, type SET NDIR=-options
   This method is convenient when you wish to make temporary, on-the-fly
   modifications to NDIR's configuration.

   If NDIR.EXE is renamed to some other filename, the name of the 
   environment variable will change with it.  For example, if NDIR.EXE
   is renamed to N.EXE, you would use SET N=-options to set the 
   environment.

Order of interpretation for command options:

The environment variable will override any default options in NDIR.EXE.
Options typed on the command line will override both the default options
AND the options in the environment variable.

//****************************************************************

Notes on using Batch mode (-b) :
--------------------------------
The purpose of batch mode is to assist you in creating DOS batch files.
The output from NDIR in batch mode is a single-column list of the 
requested filenames, with no other information.  This output is written
using BIOS functions, so the output can be redirected to printer or file.

In addition, NDIR provides a method for inserting text before and after
each filename in the listing.  The LEFT square bracket ([) is used to
indicate a string PRECEDING each filename.  The RIGHT square bracket (])
is used to indicate a string FOLLOWING each filename.  This is easy to
remember if you think of the filename enclosed in 
square brackets ( [filename] ).  Then it's easy to remember which string goes
in front of (filename) and which goes after.

Let's look at some examples of NDIR batch-mode commands.
Assume that the following files are in the current subdirectory;

NDINSTAL.C          NDINSTAL.EXE
NDIR.C              NDIR.DOC
NDIR.EXE            NDIR.HLP
NDIR.TXT            NDIRMOD.C
NDIRMOD.EXE         NDIRSRC.BAT
NDIRZIP.BAT         NUPDATE.BAT

Here are some sample commands and their outputs:
------------------------------------------------

   NDIR -B *.BAT

This will list all BAT files, in single-column, with no other information.
The output looks like:

ndirscr.bat
ndirzip.bat
nupdate.bat

------------------------------------------------

   NDIR -B *.TXT *.DOC ["PRINT " >printit.bat

The output from this command will be a list of all DOC and TXT files,
preceded by "print ", and these lines will be written to a file 
called PRINTIT.BAT .  The contents of PRINT.BAT will be:

print ndir.doc
print ndir.txt

------------------------------------------------

   NDIR -B *.EXE *.BAT ["COPY " ]" B:" >copyexec.bat

This will list all EXE and BAT files, preceded by 'copy ' and followed by ' b:'.
The output of NDIR will be written to COPYEXEC.BAT.
The output:

copy ndinstal.exe b:
copy ndir.exe b:
copy ndirmod.exe b:
copy ndirsrc.bat b:
copy ndirzip.bat b:
copy nupdate.bat b:

------------------------------------------------
