Dec 282017
 
Directory lister & file locator.
File L.ZIP from The Programmer’s Corner in
Category File Managers
Directory lister & file locator.
File Name File Size Zip Size Zip Type
L.COM 4685 3275 deflated
L.DOC 6884 2418 deflated

Download File L.ZIP Here

Contents of the L.DOC file


L (list/locate)

Locates and lists to stdout, files and/or subdirectories of:
an entire disk,
any (sub)directory,
any subdirectory and all of its descendants.

Directories '.' and '..' are never listed.


L.COM uses several types of parameters. If redundant or conflicting
parameters are present, the program terminates with the message:

L: invalid parameter

written to STDERR. If the file is renamed, it will find its name
when executed.


Parameters may be entered in any order. Lower case is converted to upper.
Only spaces and tabs are recognized as separators, however the forward slash
'/' always begins a new parameter. Normal errors terminate the program
with a message similar to the above. Unexpected errors caught by the
operating system cause the message:

L: error status =

where is the error code returned by MS-DOS. L returns from all errors
with a return code of 255.


Parameters:

The (sub)directory or root path of the (sub)tree to be searched, if
given in a parameter, is normally expected to be in a separate
parameter from the filespecs. The exception is one of the two
conditions covered in the section on reinterpretation of parameters.

Root path:

All components of the root path are optional. If the whole parameter
is omitted, each individual default is in effect. No blanks or tabs
may separate components. The components are:
a drivename, (the current drive if omitted)
a backslash, (the current path if omitted)
one or more subdirectory names separated by backslashes.
(none if omitted)
A root path parameter is recognized if it contains a colon or
a backslash and no forward slash. The parameters '.' and '..'
are also recognized as root paths. Only one root path may be used.
*** NOTE ***
The final subdirectory name may be followed by a backslash. This
serves no purpose except when the parameter contains no colon and
no other backslash, in which case it is required in order that the
parameter may be recognized as a path. See also Reinterpretation of
Parameters.

example:

L BIN\

lists files in the BIN subdirectory of the current (sub)directory,
while:

L BIN

lists files BIN.* in the current (sub)directory.

File and/or directory names:

A parameter which is not '.' or '..' and contains no '/', '\' or ':'
indicates the files and/or directories to be listed. If none are
present, the default of '*.*' is used. If it contains no '.',
then '.*' is appended to the parameter. If it begins with a '.',
then it is prefixed with a '*'. Multiple file/directory names may
be used.

Attributes:

'/D': search and list directories and files.
(may not be used with '/O')
'/O': search and list directories only.
(may not be used with '/D', '/A' or '/B')
'/A': search and list any hidden or system files or volume name.
(may not be used with '/O')
default: search and list files only; excluding system and hidden files.

Range:

'/S': search all descendant paths beginning with root path.
default: search root path only.

Format:

'/H': omit all headings, totals and empty lines: anything not
useful when piped to a sorter.
(may not be used with '/B')
default: for each (sub)directory searched that yields a nonempty
listing, write an empty line followed by the heading:

directory of

After all lists have been written, write an empty line.
If '/O' has not been selected, write:

files =

If '/D' or '/O' has been selected, write:

subdirectories =

'/2': place two names on each line.
'/4': place four names on each line.
'/5': place five names on each line.
'/6': place six names on each line.
'/8': place eight names on each line.
default: place one name on each line with attributes, sizes, dates
and times.

'/2', '/6' and '/8' assume a 132 column screen.

With '/4', '/5', '/6' and '/8' only the names of files are listed.
Directory names, when listed, are preceeded by ''.

'/.': if filetype is non-empty, it is separated from filename
by a period.
default: filetype begins nine columns to the right of the beginning
of filename and separated by spaces.

Byte totals:

'/B': before the directory search, read the boot sector. Determine
the number of bytes per cluster. For each FILE listed, get the
number of bytes used and the number of bytes in the clusters
allocated, and add them to the totals. At the end of the output
write:

bytes allocated =
bytes used =
waste =

(may not be used with '/O' or '/H')
default: no totals.

Reinterpretation of Parameters

There are two circumstances in which it may be advantageous to redefine
the meaning of a parameter. In either case the reinterpreted parameter
is used only if no listing was produced by the standard interpretation.
If a listing is produced by the reinterpreted parameters, then the
first line of the output is:

redef

If no root path and only one filespec is used, and nothing is found,
L will then treat the filespsc as part of the path and append '\*.*'
to it, if there is the possibility of finding something. In the above
example:

L BIN

if no files 'BIN.*' were found in the current (sub)directory, then
L would attampt to find files '*.*' in the offspring directory 'BIN'
of the current directory; just as if executing:

L BIN\

If the subdirectory exists and the /D or /O parameters had been used,
a listing would already have been produced; therefore, reinterpretation
would not be attempted.

The other circumstance in which reinterpretation takes place is where
a recognizable pathname not terminated by a backslash is given, there
is no filespec, and /D, /O & /S are not used. If this results in a
'path not found' error; then before reporting the error, then the name
following the last backslash is removed from the path and treated as
a separate filespec parameter. If no listing is produced, then it is
considered a 'path not found' error.

example:

L C:\TURBO\V4\HEX

L would attempt to list the files 'C:\TURBO\V4\HEX\*.*'. If the path
'C:\TURBO\V4\HEX' were nonexistent, L would then attempt to list the
files 'C:\TURBO\V4\HEX.*'.


 December 28, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)