Contents of the SDR14.DOC file
(c) 1988 by Bruce R. Childers
This program will display a sorted file directory. I
feel fairly certain that such a program already exists, but I
have yet to find it. This program was written because I needed
to display a file directory sorted on several different keys. I
have found the program to be extremely useful, and thus I've
decided to place it into the public domain.
SDR [drv:\path\file] [/sort keys/commands] [output file]
The command line is made up of three parts. The first
part, is the file specification consisting of drive, path and
file name. This tells the program what directory and files (same
as DIR) to display. Wildcards (* and ?) may be used.
The second component is made up of two subsections, sort
keys and commands. The sort keys tell the program what to sort
on. Available sort keys:
N - Sort on file (N)ame.
Y - Sort on file t(Y)pe (Subdirectory or file).
S - Sort on file (S)ize.
D - Sort on file (D)ate.
T - Sort on file (T)ime.
A - sort on file (A)ttributes.
You may specify up to six sort keys. The program will
sort the file directory in the order of the sort keys as
specified in the command line.
NY Sort on file name and type. The program first
sorts on the name, then the file type.
SDN Sort on file size, date and name. The program
sorts on the size, then the date, and finally
The default sort key is NSD.
(Name, Size and Date)
The second part (/commands) tells the program what
special options to use when running. Available program options:
W - Display (W)ide directory (horizontal display of file
names, same as DIR)
F - Write directory to disk (F)ile. This command will write
the directory to the file named [output file]. If
[output file] isn' t specified, the default file name is
R - Display (R)emaining disk space.
S - Display to the screen (this is the default).
P - Write directory output to the (P)rinter. The output is
displayed with column headings (55 lines per page).
U - Pa(U)se when the screen is full.
+ - Sort in ascending order (smallest to highest value).
- - Sort in descending order (highest to smallest value).
? - Display a description of the file type.
NOTE: You may specify only ONE output source.
WR Display the directory horizontally and display
remaining disk space.
P- Write the directory to the printer, in
The default program commands are S+ (display to the
screen in ascending order).
Display all files in the current directory horizontally to
the screen, using the default sort key.
SDR C:\MYDIR /P-
Display all files in the directory C:\MYDIR to the printer
in descending order, using the default sort key.
SDR C:\MYDIR /SD/U-
Display all files in C:\MYDIR sorted on file size and file
date in descending order. The screen will pause after 23
lines have been displayed.
SDR C:\MYDIR\*.BAS /NSD/F OUTPUT.DIR
Write the directory of C:\MYDIR\*.BAS sorted on name, size,
and date to the file OUTPUT.DIR.
SDR /SDT/FW- OUTPUT.DIR
Write the current sorted on size, date and time to the file
OUTPUT.DIR in descending order. The directory is written
The program will, by default, display all files in the
current directory to the screen sorted on name, size and date.
The program is capable of handling up to 400 file names.
If your directories are larger than 400 files, I strongly
suggest you use some subdirectories to classify the programs.
The larger the directory or the more ambiguous the file name
(eg, *.*) the longer the program runs. Try to keep your
directories small, and be as specific as possible when running
BUGS! If you encounter any bugs in the program, please
rerun the program the same way, but with the ! command. Copy
down the second line displayed, and contact me with the
information. This will help me to find any problems with the
program (the ! tells the program to print debug output).
For those who are interested, the program uses the heap
sort technique (as outlined in Vol 3, "The Art of Computer
Programming" by Knuth (A must reading for any serious computer
programmer)) to sort the directory listing.
Source code is available upon request. Write to me at the
address below, and include a 5.25" disk and return postage (I
can support most popular disk formats, except 3.5" disks). If
you would like to be notified of future updates, send me your
name and address, and I'll send you a postcard when future
versions become available.
If you have any comments, suggestions, etc on this program
or any other program I have written, you may reach me at:
Bruce R. Childers
P.O. Box 3033
Oakton, Va. 22124-3033