[comp.sys.amiga] Another how do you do .... in AmigaDOS

C475141@umcvmb.missouri.edu (BRIAN WHITMAN) (06/16/89)

I am attempting to write a general script file that when executed will
will generate a more specific script file but I am having trouble.  The
general script file contains about four lines in it.  The first three
lines look something like the following:

   list >ram:md df1:%?.zoo lformat="makedir df1:%s.dir"
   list >ram:zf df1:%?.zoo lformat="df1:zoo -extract df1:%s.dir/%s
   list >ram:rn df1:%?.zoo lformat="rename df1:%s df1:%s.dir/%s

Then I plan o preceding on to join these three files together and set the
s bit with a protect and then execute the joined file.  Sound simple eh?

Well when I look at the file ram:md it looks fine, so far so good.  Then
when I look at ram:zf or ram:rn the trouble appears.  Does the lformat
keyword of the list command only use the last %s or what?  My results in
ram:zf look like this

    df1:zoo -extract df1:.dir/file_name
                        ^
                        -  there should have been file_name here too.

also in the file ram:rn my results look similar:

   rename df1: df1:file_mane.dir/file_name
              ^
              - again the file_name is missing.

If this is invalid why? and how can I correct it?

thanks
Brian Whitman
c475141@umcvmb.bitnet

mikes@lakesys.UUCP (Mike Shawaluk) (06/17/89)

In article <17834@louie.udel.EDU> C475141@umcvmb.missouri.edu (BRIAN WHITMAN) writes:
>I am attempting to write a general script file that when executed will
>will generate a more specific script file but I am having trouble.  The
>general script file contains about four lines in it.  The first three
>lines look something like the following:
>
>   list >ram:md df1:%?.zoo lformat="makedir df1:%s.dir"
>   list >ram:zf df1:%?.zoo lformat="df1:zoo -extract df1:%s.dir/%s
>   list >ram:rn df1:%?.zoo lformat="rename df1:%s df1:%s.dir/%s
                     ^
		     +---- I assume that these are supposed to be #'s ...
>...
>Well when I look at the file ram:md it looks fine, so far so good.  Then
>when I look at ram:zf or ram:rn the trouble appears.  Does the lformat
>keyword of the list command only use the last %s or what?  My results in
>ram:zf look like this
>
>    df1:zoo -extract df1:.dir/file_name
>                        ^
>                        -  there should have been file_name here too.
>
>also in the file ram:rn my results look similar:
>
>   rename df1: df1:file_mane.dir/file_name
>              ^
>              - again the file_name is missing.
>
>If this is invalid why? and how can I correct it?
>
>thanks
>Brian Whitman
>c475141@umcvmb.bitnet

I don't have my Enhancer 1.3 docs right in front of me, but I've run into
this one myself; the trick is to put multiple %s's in your lformat keyword
text string.  It goes something like this: if there is only one %s specified,
then it will be the file name parsed by the list command; if there are two
%s's, then the first will be the *path* part of the file spec, and the 2nd
will be the file name.  In your example, since the file spec argument you
gave to the list command was #?.zoo, there was no path specified, so that
particular instance of %s became blank!  Sounds like a bummer, eh?  Well,
hang in there, all is not lost; it turns out that if there are 3 %s's, then
they become (path) (file) (file), and if there are 4, you get (path) (file)
(path) (file).  So, the solution to your second command would be:

   list >ram:zf df1:%?.zoo lformat="df1:zoo -extract df1:%s%s.dir/%s

However, the 3rd one is still going to be a problem, since you already have 3
%s's in it, and 4 appears to be the max than "list" supports, which only gives
you two invokations of the filename.  A question for you: do you have ARP 1.3
installed?  If you do, then you could use the "move" command, which doesn't
require the second file name (of course, ARP "rename" and "move" commands
also support wildcards, which would do away with the need to use "list" and
lformat altogether for this case...)

Hope this helps you figure out a solution...


-- 
   - Mike Shawaluk 
       (mikes@lakesys.lakesys.com  OR  ...!uunet!marque!lakesys!mikes)
    "Where were you on the night of August 12?"