home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
083.lha
/
Walk.doc
< prev
next >
Wrap
Text File
|
1986-11-20
|
5KB
|
120 lines
Walk V0.1 - Nov. 10, 1987
Walk is a CLI utility for performing a given CLI command on a group of
files. The name arises because the utility "walks" down a given directory
and all of it's subdirectories, performing the given command on each file
that matches the optional pattern. The easiest way to explain what walk does
is to show how it is used, and then discuss the finer points of each of it's
arguments.
Invoking Walk
Walk "d=Dir" "l=levels" "p=pattern" "+V" "c=Execute string"
where:
Dir is an AmigaDOS type directory ( ram: df1: df0:c sys: fonts: etc. )
The "d=" is mandatory, but quotes are only needed for directories
containing spaces. The "d" can be in upper or lower case.
levels is an integer indicating how many subdirectories down to scan.
All directories up to this many levels down will be "walked".
"l=1" will do only the main directory level. The "l" can be either
upper or lower case. Quotes here are superfluous, but allowed.
pattern is a standard AmigaDOS wildcard pattern. The "p" can be any
case. Only files matching the pattern will be affected by the command.
The "+V" ( or "+v" ) command will cause each selected file's name to be
printed.
The "c=Execute String" tells the program which CLI command to perform on
the selected files. Two special characters in this string give the
program most of it's utility. Wherever there is an '@', the currently
selected filename will be substituted. If your execute string were
"c=echo @", each of the selected files names would be printed on your
screen. Another special character is useful when copying and renaming.
It is the '#' symbol, which backs up one character during expansion.
This is only really useful immediately after an '@' symbol, for chopping
a few characters off the end of a filename during a command. For
instance:
Walk +v p=#?.h "c=rename @ @##.c"
would rename all files ending in ".h" to end with ".c". More than one
"c=command" string is allowed, in which case the commands are performed
in the order they are specified. For example:
Walk +v p=#?.c "c=copy @ ram:" "c=delete @"
would copy each file to ram:, then delete the original.
The arguments can be given in any order, and the quotes are only needed
if the argument contains spaces.
Now I got It & I Know How It Works But What The Hell Do I Do With It?
Have you ever done this:
list >file quick
or this
dir >file opt a
and then edited the resulatnt file into an execute script? Well, this
program can make using the CLI a lot less drudgerous. You can delete
all the ".info" files or ".fastdir" files in every directory in one
fell swoop ( or one swell "foop"). You can rename old Musicraft scores
to ".smus" files with one command. You can print out all your header
files quick as you please, or copy them somewhere or whatever.
With this command, the "protect" command is much easier to use, and
much more useful as well. The "setdate" command also takes on a
whole new importance. Multi file compiles are much easier on those
who have no "make" facility. The best way to learn what it can do for you
is to use it.
WARNING
This program can be very dangerous if used improperly. Power is power and
it must be handled with care. You might want to try giving no command
( yes it's legal ) with verbose on to see which files will be operated
on. The program responds to <CTRL> 'C', but it will leave locks lying
around and keep some memory. You will also be left in whatever directory
was being scanned at the time.
Defaults are 100 for number of levels, the current directory if not
specified, verbosity off and if no pattern is supplied, "#?" will
be used.
If for some reason the command you have given is not found, the program
may hang up. It will also terminate if you alter the contents of the
directory it is currently in. This would happen if you gave a command
of "c=delete #?". Needless to say, this is a pretty dumb thing to use
this program for, but nevertheless it can happen.
These and other bugs/inadequacies will be taken care of in a future
version, at which time I may also release the source code. The reason
I am releasing this now is that I thought many people would find it
useful. Please direct your comments to me via:
Mail: Pete Patterson
95 Marshall Park Drive
North Bay, Ont. ( Canada )
P1A - 3L1 (705)-474-3363
CompuServe: 72017,1251
COMING SOON:
A command to reassign EVERYTHING to a different disk without re-booting.
Actually, the prg. is finished, but I'm too lazy to write docs and
upload it. If you want it, let me know!