home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Big Blue Disk 4
/
bbd04new.zip
/
LS.DOC
< prev
next >
Wrap
Text File
|
1986-12-01
|
8KB
|
231 lines
^1 The LS Command
By Bryan Higgins
Version 2.12
For MS-DOS 2.0 or later
List Files
The LS command is a directory lister, much in the fashion of the LS command in
UNIX. It basically performs the function of the DIR command in DOS. However,
it has many special features which DIR lacks. Advantages (admittedly a matter
of (good) taste) over DIR:
o Files are listed in alphabetical order by default
o Default is "wide" (/W in DIR-speak)
o Default is to omit ".", "..", hidden files, and volume ID
o Lists day of week (Monday, Tuesday ...)
o Uses 24-hour time
o Lists byte-count & directory-count totals
o Shows file attributes
o Flags directories
o Pauses on full screen ("More")
Useful options:
o List only files dated after a given date
o List only files changed since last backup
o Recursively list sub-directories
o Show remaining space on drive only
o Show total file space only
o Sort by file date & time
o Sort by file extension
o Sort by file size
o Exclude files from listing
o Feed file list into filter
LS is intended for use with a Winchester (hard disk) or RAM disk. However, it
will also work with floppy disks. There is a slight delay on large directories
as LS must read up all directory entries and sort them before displaying the
first.
Usage: Type LS, followed by its arguments. These can include a series of
option switches, which are letters of the alphabet used to designate special
features. A series of switches should begin with the hyphen (-) character.
The formal syntax of LS is as follows:
ls [-acdefglmnorstuvxy?] [-w[<date>]] [<file>] ...
The square brackets indicate optional arguments.
<file> indicates a file specification of the form accepted by DIR,
formally:
[<drive>:][<path>][<name>][.[<ext>]]
All components are optional and have the same defaults as DIR. The <name> and
<ext> portions may contain wildcard characters.
A plain
ls
will list all files in the current directory (except hidden files,
volume ID, ".", and "..") sorted alphabetically, five per line. The number
of files matched is always given, along with the total byte count of files
matched. Directory names are appended with a backslash.
The options are
-a (All) List ".", "..", hidden files, and volume ID if
matched
-b (But) Inverts the meaning of -c -d -t -y and -w (see
below)
-c (Changed) Restrict matches to files changed since backup
-d (Directories) Restrict matches to directories
-e (Extension) Sort alphabetically on file extension
-f (Filter) Single-column (filter-ready) listing
-h (Hugest) Sort by size, largest to smallest
-l (Long) Long listing: dates, sizes & attributes
-m (Minisculest) Sort by size, smallest to largest
-n (Newest) Sort by date & time, newest to oldest
-o (Oldest) Sort by date & time, oldest to newest
-r (Recursive) Search subdirectories recursively
-s (Summary) List only total counts and sizes
-t (Today) Restrict matches to files dated today
-u (Unused) Shows space remaining on drive (no files listed)
-v (Version) Show LS version only
-w (When) Restrict matches to files dated on or after a
given date, where <date> is one of
o A full date, e.g. 11/22/85
o A day in the current year, e.g. 11/22
o A day of the current month, e.g. 22
A missing date restricts matches to files dated in the
current week, beginning on Monday
-x (eXcept) Don't list files matching subsequent arguments
-y (Yesterday) Restrict matches to files dated yesterday or
today
-? (Huh?) Show command format
Options may be combined, e.g.
ls -aln *.c
or segregated:
ls -a *.c -ln
The -w option should be last (or alone) in a group.
The -b option inverts the meaning of -c -d -t -w and -y; thus
ls -bd
will list all non-directory files,
ls -bt .exe
will list all .EXE files but those dated today, and
ls -bw1/1/85
will list all files dated before 1985.
The -x option excludes from the listing files matching ALL subsequent arguments
(this is a change from former versions), thus
ls -x *.c .asm
means list all files except .C files and .ASM extensions, and
ls p*.* -x *.exe
means list all files beginning with P except .EXE files.
In the attributes given in the long (-l) listing, W means read/write, R means
read-only, H means hidden, S means system file, and A means changed since
last archive (backup).
Two byte counts are given with -l. The first is the number of bytes of data
in the file; the second is the amount of room the file takes up on the disk
(disk space is allocated in largish fixed-size increments).
The -s option does not list file names, but rather gives a summary of the
count and total size of the files specified.
The -f option is intended for use with filters; matching files are listed
one per line, with no heading or summary information. You may not understand
the purpose of this option at present, but it will become clearer in future
months as we present other Kramden utilities which are capable of taking the
output generated by LS with the -f option, and using it to perform a variety
of actions on specified lists of files. For example, you will be able to use
a combination of Kramden utilities to perform selective or complete backups of
your files. Such uses will be documented in future issues of BIG BLUE DISK in
the documentation for Kramden utilities which can be used in combination in
such a manner.
Only one of the -e, -h, -m, -n, or -o sorting options should be given.
If the screen fills, LS pauses and prompts with
More?
An answer of 'N', 'n', or '^C' will terminate LS; anything else continues.
Examples:
o All ordinary files in current directory
ls
o All non-directory files
ls -bd
o Long listing of files LS.*
ls -l ls
o Long listing of files dated today:
ls -alt
o Files dated this week
ls -w
o All .EXE files, newest to oldest:
ls -n .exe
o All .C files dated on or after November 3, 1984
ls -w11/3/84 .c
o All files dated this year, oldest to newest
ls -lw1/1 -o
o All files dated on or after the 3rd of this month
ls -w3
o All non-.EXE and non-.COM files, sorted by extension
ls -x .exe .com -e
o Count size and number of .exe files in current directory
and below:
ls -rs .exe
o List all files on current disk not backed up:
ls -cr \
o Get count and size of all files on current disk not backed
up:
ls -crs \
o List all directories on the disk
ls -rfd \
Copyright (c) 1985, 1986 by Bryan Higgins.