B.EXE dir command v. 1.32 (31/10/1996, Dohn Arms) |
Readme/What's new |
B.EXE directory lister for OS/2 and DOS
Version 1.32 October, 1996
Dohn Arms
Copyright 1996 Dohn Arms
Permission to use, copy and distribute this software and its documentation
for any purpose and without charging more than a nominal fee for copying is
hereby granted, provided that the above copyright notice appear in all copies
and that both that copyright notice and this permission notice appear in
supporting documentation. This software is provided "as is" without express
or implied warranty.
This program is "freeware" which means that you do not have to pay for it.
It is not public domain, which means that I own the program and no one is
allowed to alter the program before redistributing it, which includes running
B_EDIT on B.
The only thing that I ask of anybody that actually uses my program is that
if they have access to E-mail, that they send me a message telling me if my
program is particularly useful or not. I just want to see that people
actually use this. My E-mail address is: dohnarms@uiuc.edu .
What is this program?
This is a command line program that is to be used to view the contents of
a directory. This program is designed to be an alternative for DIR. It has
also has almost all of the functionality of DIR. The reason I wrote the
program was because I disliked DIR and I wanted an easy way to view the
information contained in a directory. Like DIR, you can also set default
switches in an environment variable.
What's with the name?
The name was simply a convenience for me due to the fact that I like one
letter names for programs that I use a lot. I already had programs named C,
D, and E, so I named it B. If you don't like this (which I would probably
think true), rename it to whatever you like. The program is written with
renaming it in mind. The help text (seen with /? switch) will reflect the
new name, as will the environment variable. The only condition is that you
must keep the .EXE extension in the new name (there are ways to run EXE
programs after dropping the .EXE extensions). So change B.EXE to BDIR.EXE if
you like, and look at the help screen. The environment variable would then
be BDIR, also.
(I was in Germany for research, and I was using a DOS PC to do some
programming. I found a program named D. Figuring it would be a program
similar to mine, I ran it. It was my B, renamed to D! Talk about weird!
I never expected to run into my program in another country!)
What's with all these switches?
I love switches, thus this program relies heavily on switches. Hopefully
you know how to use them, although I tried to make B useful even if you don't
change any of the settings. Because of this, if you never use a switch, you
don't get to see half of what B can do. PLEASE PLAY WITH THE SWITCHES! Some
of the switches are of the type that you might use every once in a while from
the command line (like the one that goes and sums the sizes of the
subdirectories for you), while there are others that are useful only in the
environment variable or a CMD file as they are very long and not likely to be
changed (like the switch to change the colors of everything in the program).
Why is there no configuration file?
As this is a replacement for DIR, probably the most used command line
"program", I wanted to keep it fast, as I don't like to wait just to see the
file listing. This is why there is no configuration file, as file IO is too
slow. To set default settings, you must set the environment variable,
something that is not very hard and an important thing to know how to do, or
you can use a CMD file with the switches in it. There is also an accompanying
program, B_EDIT, which will allow one to alter the executable file to change
the default settings of the program instead of the variable or command files.
There is a seperate document, B_EDIT.TXT, which describes B_EDIT.
Description:
When run with no switches, you will see all the files and subdirectories
in a directory. The uppercase brown names are the subdirectories. The gray
names are files that do not have an extension that is being searched for.
Anything of another color is a file of a searched-for extension; the colors
are yellow, light green, red, cyan, light cyan, and dark green (these are the
official names for these colors). By default, the extensions for OS/2 are
EXE, COM, CMD, INF, TXT, and ZIP. For DOS, they are EXE, COM, BAT, DOC, TXT,
and ZIP. If there is an asterisk next to a subdirectory or a file, that
means that the file or subdirectory is hidden (from normal view, anyway) or
is a system file or both. If the name of a file is uppercase, that means the
file is either read-only or is a system file or both (if the file is composed
of characters with no cases (such as numbers), you won't be able to tell).
Under the listing of files and subdirectories, the directory being shown
is displayed. Under that is the total number of files shown, with the total
size of the files (I haven't fixed B to add EA's yet). Also, to the side of
this is the total number of subdirectories shown.
If all the files can't fit onto the screen, the scrolling stops when the
maximum number per screen has scrolled by. If you don't want to see any more
of the files, you can stop the scrolling by merely pressing the Escape key
("Esc"), pressing Ctrl-C (the "C" key while the "Ctrl" key is pressed), or
pressing Ctrl-Break (the "Pause" key while the "Ctrl" key is pressed).
All the files that were visible remain visible on the screen. In the wide
view (/W), you will only see file names. In the default normal view (/N),
there will be a size in bytes next to each file, and a "<DIR>" next to
each subdirectory. In the date-time view (/D), there will also be the time
and date of the last write of each file and directory. If you are using one
of the previous views and if a file or subdirectory name is longer than 13
characters, in the OS/2 version of B, there will be a ">>" character at the
end showing that the file name has been cut off. In the long view (/L), the
complete file name is shown, along with file attributes the and time up to a
two-second interval.
Using the sort switch (/O), you can change how the files and directories
are sorted. You can choose to not sort (/OU). There is the default sort by
name (/ON), sort by extension (/OE), sort by size (/OS), and sort by time
(/OT). Using the last three switches, if files have the same extension,
size, or time, they will be sub-sorted according to name. You can specify a
reverse sort for any of them (except /OU) by adding a negative sign before
the second letter (such as /O-N for a reverse name sort).
There is a switch that allows the directories to be grouped apart from the
files (/G). It is on by default, but can be turned off with /-G.
If you wish to see only files, using the file-only switch (/JF) will
remove all subdirectories. If you wish to just see the subdirectories, using
the subdirectory-only switch (/JD) will show only subdirectories. To see
both files and directories, the default, use the all switch (/JA).
If you wished to see the free space on the disk where the directory viewed
is, use the free-space switch (/F) and the information will appear at the
bottom, along with the total space on the disk and the volume label.
If you want to see what the extensions being highlighted actually are, use
the extension viewing switch (/E), and they will appear in their respective
colors at the bottom of the screen.
If you want to see the total sizes of subdirectory trees and the total
size of the current directory tree, using the size summing switch (/Z) will
have the "<DIR>" next to each subdirectory replaced with its size in
kilobytes (1 K = 1024 bytes). Also, at the bottom, the total directory size
will be displayed. If you were using the name-only mode (/W), it will
automatically be kicked up to the name and size only mode (/N), as you would
probably want to see the sizes.
If you wish to do a recursive search through subdirectories, there is the
recursive switch (/S). From the directory that is specified, and the file
mask also specified, all the files matching the mask in the specified
directory and any subdirectories in this directory will be shown. For every
directory, if any files are found, the files will be shown, with the
directory being shown under it. As this switch is almost a separate program,
a find utility, many switches don't work with it: these are /F, /E, /P, and
/I. If the size summing switch (/Z) is used with it, it will show the total
size of the files in each directory, and will also sum the size of all the
files found at the end.
There is a switch for putting the path and mask after the files and
directories are shown (/P). This is on by default, but this switch
effectively lets you turn it off with /-P.
There is a switch that shows the number of files and directories, and the
total size of all the files in the directory (/I). This is on by default,
but can be turned off with /-I.
For cosmetic purposes, if the number of files and directories is equal or
below a certain number, they will be shown in one column. This number is 4
by default. If the number of entries is from 5 through 8, they will be shown
in two columns if possible, etc. There is a switch to change this number
(/H). You can use a number from 1 to 9, and just set it right after the /H.
For example, to set this number to 3, use /H3.
If you don't want to see any of the extraneous information after the files
and directories are shown, and if you want what is shown as compact as
possible, use the bare switch (/B). Effectively, this fits the most on the
screen for you if you need to conserve space. This is not actually a true'
switch, as it really just is shorthand for /-F /-E /-P /-I /-Z /H1 which
means it turns off a bunch of other switches. Because it is not a true'
switch, it can't be reversed.
If you want to redirect the output of B say to a file or printer, the
output has to be in the form of a colorless TTY mode. To force this mode,
there is a switch (/T). The output will not be in colors, does not pause,
and there are no breaks.
[NOTE: If you don't know what I am talking about, to save the output of B to
a file, use the following: "B (switches) /T > (filename)". The >' redirects
the output into a file with name filename'. To redirect the output to the
printer, use the following: "B (switches) /T > PRN".]
Most people will probably want to change the default extensions to suit
their needs. The extension changing switch (/C) will allow this. You can
supply a list of up to sixteen extensions, each having up to three letters.
To do this, simply space out each extension after the /C switch. For
example, the default OS/2 extensions would be added like this:
/C COM EXE CMD INF TXT ZIP
The DOS extensions I use are:
/C COM EXE BAT DOC TXT ZIP C CPP H HPP GIF JPG DAT ASM TEX
The default colors taken by the extensions are all different. You can change
all 16 colors, with some being repetitive if you want, with the color switch
(/A).
Some people might want to change the default colors. To do this, there is
a switch to alter the color scheme (/A), which you may find cryptic. You can
specify colors for any of the 15 text types: 1) the color of any information
text seen, 2) the color of the subdirectories, 3) the color of the
unhighlighted files, 4) the color of extension one, ... , and 15) the color
of extension twelve. These allowable colors and their numeric equivalents
are shown in the table below. The complete way to set this switch is to put
after the /A the first foreground color, then a comma (you can't change the
background color of the information text), then the second foreground color,
then a colon, then the second background color, then a comma, then the third
foreground color, then a colon, ... , then the fifteenth foreground color,
then a colon, and then the fifteenth background color. For a full example of
this (this can be abbreviated, as explained later):
/A5,11:4,10:2,4:7,2:6,5:0,0:7,13:3,9:3,14:1,3:6,1:4,15:3,11:4,1:6,8:3,7:0,12:3,2:6
You do not have to specify every color for every text type, but can skip
some, as their colors will remain the same as before the /A switch. You can
skip either the foreground color or the background color or both for a text
type. To skip both, just put nothing in between the commas. To skip the
foreground color, just don't put a color number between the comma and the
colon. To skip the background color, don't put either the colon or the
background color. You don't even need to specify all 15 colors, but can just
specify the first, for example, 10 colors. For example:
/A,4,1,4:7,,,14,10:3,,:5
You only need to specify what you want to change. If you want to only use
your normal background color (probably black), just don't even touch the
background colors:
/A5,11,10,4,2,5,0,13,9,14,3,1,15,11,1,8,7,12,2
[NOTE: you can't change the background color of the first /A color, although
it won't give you an error if you try.]
COLORS: you may choose from 0 - 15 for foreground, 0 - 7 for background
0 = black 1 = blue 2 = green 3 = cyan
4 = red 5 = magenta 6 = brown 7 = light gray
8 = dark gray 9 = light blue 10 = light green 11 = light cyan
12 = light red 13 = light magenta 14 = yellow 15 = white
To see the actual colors on the screen, use the /? switch, as it shows them
all.
B will add implicit wildcards, like MS-DOS. If you use "B CAT", it will
expand it to "B CAT.*". If you use "B .ZIP", it will expand it to "B *.ZIP".
For DOS, if you use "B CR*", it will be expanded to "B CR*.*".
If switches are already set, and you don't want them set, you can always
turn them off. For most switches, simply add a negative sign before the
switch letter; for example, to turn off /F, one would use /-F.
You do not have to put spaces between the switches. Only one switch does
not conform to this, being /C, which explicitly needs spaces in the first
place. (This is a legacy thing since /C was the first switch I implemented,
and I am thinking of changing it to use commas in between.)
If you like a certain set of switches to be used by default, you can put
them into the environment variable. To do this, the command looks like:
SET B=(switches)
You can do this from the command line, or you can put it in your CONFIG.SYS
(for OS/2) or AUTOEXEC.BAT (for DOS). An example would look like:
SET B=/F /O-D /A,4 /C C ZIP EXE CMD H
[NOTE: If you changed the name of B to something else, the environment
variable will also be changed from B. If you renamed B.EXE to BDIR.EXE, the
variable would be BDIR.]
A different way which is slower, but easier, is to create a command file
(for OS/2) or a batch file (for DOS). All you would have to do is create the
file with the correct extension, CMD for a command file or BAT for a batch
file. The only line needed would look like:
(path)B.EXE (command line switches) %1 %2 %3 %4 %5 %6
A sample CMD file, say BB.CMD, could look like:
E:\TOOLS\B.EXE /D /F /-P /C EXE COM CMD C CPP H HPP %1 %2 %3 %4 %5 %6
[NOTE: If you don't know this, you need to include the %1, %2, etc. because
these allow you to pass arguments to the CMD or BAT file. Also, I wouldn't
name your CMD or BAT file the same as what you name B, if B is in your path,
as an EXE takes precedence over a CMD or BAT file; i.e. don't name your file
B.CMD if you leave B as B.EXE and it is in your path.]
Once you make your file, make sure you put it in the path.
The last way is to use the B_EDIT program, which has the document B_EDIT.TXT
to explain how to use it. You need the same switch information as above for
B_EDIT, as it uses the same switches.
If you want to know what switches are on by default, using the help screen
(/?) will show you the switches on, except for /A and /C which would take up
too much room.
Form of Command:
B.EXE [path][wildcard] [/?] [/W|/N|/D|/L] [/J<F|D|A>] [/O[-]<N|S|E|D|U>] [/B]
[/[-]S] [/[-]Z] [/[-]T] [/[-]F] [/[-]E] [/[-]P] [/[-]I] [/[-]G] [/H(1-9)]
[/C [ext 1] ... [ext 16]] [/A[f1],[f2][:b2],...,[f19][:b19]]
/? The help screen
/W Wide view (uses five columns with only file names)
/N Normal view (uses three columns and adds file sizes)
/D Detail view (uses two columns and adds dates and times)
/L Long view (uses one column and adds long names and attributes)
/J% Just show files, directories, or both.
/JF Shows just files
/JD Shows just directories
/JA Shows both files and directories
/O[-]% Changes sort order, '-' before % does reverse sort
/ON Does alphabetical sort of the names
/OS Does numerical sort of the sizes
/OE Does alphabetical sort of the extensions
/OD Does chronological sort of the times and dates
/OU Does not sort at all
/[-]B Shows only bare format of just directory and file names
/[-]S Does a recursive search through subdirectories using mask
/[-]Z Sums the sizes in each subdirectory tree and in current directory tree
/[-]T Outputs the information in TTY mode for redirection
/[-]F Shows the free space on the disk where you are viewing the directory
/[-]E Shows the extensions used for highlighting in their highlighting colors
/[-]P Shows the path and mask for the directory being viewed
/[-]I Shows the number of files and directories and total size of the files
/[-]G Groups the directories apart from the files
/H% Sets the minimum column height before starting new column to %
/C [extension 1] [extension 2] ... [extension 15] [extension 16]
Changes highlighting extensions to those specified
/A[fc1],[fc2][:bc2],[fc3][:bc3],...,[fc18][:bc18],[fc19][:bc19]
Changes the color scheme: bc = background color and fc = foreground color
Text order is: information, directories, unhighlighted files,
extension 1, ..., extension 12
The colors are:
0 = black 1 = blue 2 = green 3 = cyan
4 = red 5 = magenta 6 = brown 7 = light gray
8 = dark gray 9 = light blue 10 = light green 11 = light cyan
12 = light red 13 = light magenta 14 = yellow 15 = white
To set default switches: "SET B=(command line arguments)"
Contacting the Author:
If you have any comments or questions about my program, feel free to
E-mail me or write me. If you find bugs, please tell me. I actually want to
hear from you if you actually use this, so I know my work in putting this on
the Internet has not been in vain. I hope you find this useful.
E-Mail: dohnarms@uiuc.edu
Mail: Dohn Arms
Loomis Laboratory of Physics
1110 West Green Street
Urbana, IL 61801-3080
-------------------------------------------------
Version 1.32 all done around October, 1996
I had a complaint a long time ago about ending up in the wrong directory
if you break out of the program during a puase by using a CTRL-C or CTRL-Break.
Well, my program used to actually change the directory as it worked, but now
it doesn't. It was trading one set of problems for another, but it seems to
make the /S switch faster now. I enabled the CTRL-C to work exactly as ESC
now, for both DOS and OS/2.
I added a new program, B_EDIT.EXE, which will allow you to actually burn
your preferred switches into B. This way you don't have to mess with the B
environment variable or creating batch and command files. Essentially, one
uses the same switches with this new program. However, the environment
variable still works as normal.
I hacked on the sorting routine to streamline it some, and make the
sorting faster. There is no other noticeable difference to the user because
of this. |
Aggiungi un commento