[comp.sys.amiga] ADD-command

toweri@clinet.FI (Jukka Lindgren) (10/04/89)

Here is a small batch file that I created the other day, when I wanted
to copy some useful CLI-commands from one disk to my own C: directory

None of the original copy commands check, if the file already exists
in target directory, thus overwriting them with possibly ones that are
extended with a virus (dir-command). Or perhaps you have some enhanced
CLI-commands in your C: directory, that you don't want overwritten.
Not to mention all that wasted time copying same files all over again.

So I had to make one!

The method of selective copying is simple enough: I used the new facility
in list -command, the "LFORMAT=" -option. The FROM-DIR is listed and
redirected into a temp file with appropriate text string joined with
each filename. What we end up with, is a batch file, which checks
existense of each file in TO-DIR, if it isn't there, it is copied.

It creates the temp file in T: -directory (it is good idea to assign T:
to RAM: disk) and executes it. 

It goes without saying, that WB 1.3 is essential!!

There are some drawbacks though. It won't create any subdirectories,
but copies all files from subdirectory into TO-DIR itself and subdirectories
within subdirectories will be ignored altogether.

If you find some way to cure these problems (?), please mail me a copy!
Also any suggestions and comments are welcome.

----- cut here ----- cut here ----- cut here -----
.KEY source,dest
echo "*N ADD -command   (C) 1989 by J.E.N."
if "<source>" EQ ""
   skip usage
endif
if "<dest>" EQ ""
   skip usage
endif
echo "*N  -Adding files from <source> to <dest>"
cd <source>
sys:c/list > T:q<$$> #? LFORMAT="if not exists *"<dest>/%S%S*"*N  copy *"<source>/%S*" <dest>/*Nendif"
cd <dest>
execute T:q<$$>
QUIT
lab usage
echo "*NUSAGE: Add FROM-DIR,TO-DIR/A*N  -Copy ONLY those files from source-dir that DO NOT already exist*N   in destination directory"

--
Hope you enjoy it!!

-=toweri=-

= VOICE: + 358 0 571789              || Any opinions expressed contain        =
= EMAIL: toweri@clinet.fi            ||     * The Absolute Truth *            =
= or: ...!mcsun!santra!clinet!toweri || Therefore no disclaimers can be made  =
= SNAIL: don't bother...             ||              (I KNEW you'd hate it !) =
-- 
= VOICE: + 358 0 571789              || Any opinions expressed contain        =
= EMAIL: toweri@clinet.fi            ||     * The Absolute Truth *            =
= or: ...!mcsun!santra!clinet!toweri || Therefore no disclaimers can be made  =
= SNAIL: don't bother...             ||              (I KNEW you'd hate it !) =