MAG Disk (Apr 1990) : ThingsToRead / Convert.doc

                                  CONVERT
                                 ---------
      A script utility to convert Arc, Zoo, and Pak files to Lharc files

[If you're the type that doesn't read docs, but you still actually expect
this script to work for you, please at least read the short REQUIREMENTS and
USAGE sections below.]

     Convert is a compact AmigaDOS script file that will automatically
perform the conversion of Arc, Zoo, and Pak files into smaller Lharc files,
freeing up a lot of space.  It will convert a whole directory in one sweep;
the .arc, .pak, and .zoo files will then be deleted and replaced with .lzh
files.  If you have a disk full of various archives which are not in
directories (i.e., everything is in the root directory), it will convert the
whole disk for you.  For Zoo files containing directories, the directory
structure is maintained in the newly created Lharc file.  Once started,
Convert runs automatically without any input from the user.  It can also be
run from Workbench via IconX with the icon included in this archive.  Convert
can also be easily customized to work in different situations.
     Convert will work fine even if you have only one type of archive in the
directory, for instance if you have a disk full of Zoo files only.  It will
also work fine if, say, the disk or directory has nothing but a single Pak
file in it, or is full of Lharc files with just a couple Arc or Zoo files.
The number and kind of archives in the directory or on the disk does not
matter.  In fact, you can run Convert on a disk with NO archives on it, and
it will simply exit rather quickly since there is nothing for it to convert.
Be aware though, that unarcing, unzooing, unpaking, and then lharcing can
take a long time.  A disk packed full of archives can take as long as 30
minutes to convert.
     It's my opinion that useful utility scripts should be as absolutely
small and efficient as possible, so I tried to fine-tune and reduce Convert
to the smallest possible number of lines and bytes.  Rather than having
beginner's instructions and error messages echoed to the screen during
execution, I've opted for a longer doc file to explain things, keeping
Convert itself down to 863 bytes - small enough for anyone's Workbench.
Convert is not really meant for beginners, so if it fails you'll probably be
left with an open CLI window, an unremoved `Assign', some temporary files in
ram, and no real explanation other than an AmigaDOS error code.  If you're
not familiar with AmigaDOS script files please read this doc carefully, and
get some help before you try changing Convert as described in the CUSTOMIZING
section below.  Convert will probably not work correctly if you make even a
small mistake editing it.

 REQUIREMENTS
--------------
     Due to one of the well-known limitations of the standard AmigaDOS
commands, Convert requires the use of the ARP "Rename" command.  It will work
fine if the other commands in your C: directory are the normal AmigaDOS 1.3
commands, but your "Rename" command MUST be the ARP version, or Convert
*WILL* definitely fail.
     In addition to the normal AmigaDOS commands needed for execution of
script files, Convert requires that you have LHARC, ZOO and PKAX in your C:
directory.  (The required location of these programs can be easily changed,
and ARC can be substituted for PKAX.  See the CUSTOMIZING section below.)  If
used from Workbench, IconX must be in your C: directory.
     Since Convert does it's work in ram, make SURE that you have enough free
if you'll be converting large files.  You'll need more than twice as much
free ram as the largest file being converted.  (This can be changed if
necessary; see the CUSTOMIZING section below.)

 USAGE
-------
     From a Shell:

          1> convert [directory]

where [directory] is the optional name of a directory which contains the
archives you want converted to Lharc archives.  Examples:

          1> convert
          1> convert df0:
          1> convert df1:Downloads/
          1> convert dh0:ArchiveFiles/

     If the directory is not a root directory, you MUST include the "/" after
the directory name.  If no directory is specified, Convert defaults to the
root directory of the disk in DF1:.  PLEASE NOTE:  This usage only applies if
you are using the Shell (not a CLI), Convert's script bit is set, and it is
somewhere (usually S:) in your path, or in your current directory.  This is
the recommended (and easiest) way to use script files, but if your
environment is different, you can always do a

          1> execute convert [directory]

from a CLI or a Shell.

     From Workbench:

     Double-clicking on Convert's icon will run Convert on the root directory
of DF1:.  (This can be easily changed; see the CUSTOMIZING section below.)
     If you'd feel safer testing it out first before converting your valuable
archives, copy a small .arc, .zoo, and .pak file to an empty disk in DF1:,
double-click on Convert's icon, and watch it go.  When it's finished, check
the disk and you'll have only .lzh files on it.  I think you'll be pleasantly
surprised at how quick and easy it is.

 CUSTOMIZING
-------------
     If you normally keep LHARC, ZOO, and PKAX somewhere other than in your
C: directory, (for example, DH1:Utilities), you can edit Convert so that it
will find them wherever you have them.  Just insert the full path immediately
after the "*n" and immediately before "lharc", "zoo", and "pkax" where they
occur in the script.  "Lharc" appears once in lines 9, 12 and 15; "pkax"
appears once in line 9; "zoo" appears twice in line 12, but insert the path
before the first one only.  Do NOT change the second "zoo" in line 12, or the
"zoo" in line 11.  If by chance you have them named something other than
"lharc" or "zoo" or "pkax", then of course you must change the script to
reflect the name you use for them.
     PKAX is much faster at unarcing files than ARC, but if don't have it and
use ARC to unarc files instead, then edit the 9th line.  In place of "pkax",
insert "arc x".  (Include the full path if ARC is not in your C: directory.)
     If you want to change the default directory that Convert looks for, edit
line 2 and change the "df1:" to whatever you prefer; leave the quotes there.
Remember, the default will only take effect if you do NOT specify a directory
on the command line, OR when you run Convert from Workbench.  If you change
the default to something other than the root directory of a disk, remember to
include the final "/" (for example, "DH0:Archives/").
     Convert does its converting in ram and needs more than twice as much
free as the largest file being converted.  If you have an unusual
configuration such as only 512K with a hard disk, you can change this.  Just
change ALL 15 occurances of "ram:" to "dh0:", or whatever you prefer.
     If you are running Convert from Workbench and want it to do its work
invisibly, without IconX's window appearing, edit the WINDOW tooltype in
Convert's icon and change it to read WINDOW=NIL:.

 A FEW THINGS TO CONSIDER
--------------------------
     Several things were either brought up by someone that tested Convert for
me, or I ran into them myself and thought they should be mentioned:

1.  Be aware that a Pak'd file does not display any information on your
screen when it is unPaking, unlike unArcing or unZooing a file.  If it's a
large Pak file, it may appear that Convert has "gone to sleep".  This is
normal.

2.  A tip to save a few keystrokes when running Convert on your current
directory:  If you're CD'd to the directory you want converted and it has a
long path name, like "dh1:downloads/newstuff/", instead of typing the whole
path name, just say "convert here:".  This works because Convert makes a
logical assignment of "here:" to your current directory when executed.

3.  A few rare files contain nested archives; they are usually source code or
docs that were separately Arc'd or Zoo'd together inside of the parent Arc or
Zoo file.  Since nested archives are so rare, I've left them as is rather
than double the size of Convert just to check for and take care of them.  The
nested archives will remain Arc or Zoo files inside the new Lharc files.
Your new Lharc files, though smaller, will also still have those pesky
"execute.me" files which are in lots of Arc files.  The execute files are not
always named the same thing - sometimes they're called "X.it", "ex.me", or
something else - so there's no way to take care of them in an automated
script file.

4.  One tester had a problem with an older version of Lharc.  I could not
reproduce the problem, but I'd recommend using the latest version of Lharc.

5.  A few rare archives might have the Lharc or Zoo or Arc program itself in
the archive.  If it's an old version that works slightly different than the
latest version, Convert might have a problem.  The same is true if an archive
contains a PD replacement for an AmigaDOS command that is used in Convert,
and the replacement version is not 100% compatible.  This is because Convert
is CD'd to the directory it's unarc/zoo/paking in, so it would use that old
version of Lharc or Zoo or Arc, or the different AmigaDOS command, instead of
the one in your C directory.  (If you're really the cautious type, you could
take care of this by putting "C:" in front of all the AmigaDOS commands in
Convert.)

6.  Someone is bound to email me about how risky it is to delete the original
archive file before copying the new .lzh file in its place, which is what
Convert does.  If you think for a minute you'll see why it has to be done
this way, at least for floppies.  Every one of the 30 or 40 floppies I've run
Convert on is at least 95% full, sometimes 99%.  I've seen other script files
that attempt to do what Convert does, but fail totally on every one of my
disks because they try to write the new archive before making enough room by
deleting the original.  If you happen to have a power outage during the
instant betweem the original's deletion and the copying of the new file, all
I can say is, God must not like you and you'll just have to download that
file again.  If this bothers you, and you're certain that you'll always be
using Convert on a hard disk with lots of room on it and never on a 99% full
floppy, you can easily change the order things are done in the script.

7.  The slowness of Lharc used to be a major irritant, but there is a new
version of Lharc called LhArcA, by Stefan Boberg, which is much faster.  This
new LhArcA is a Workbench version only, but the docs promise a CLI version
soon.  If/when the CLI version comes out you may want to edit Convert to use
it instead.  (You would change lines 9, 12, and 15; see the CUSTOMIZING
section above.)  There's also a new utility to unarc Lharc archives, called
Lhunarc, by Jonathan Forbes, that is MUCH faster at unarcing than Lharc is -
similar to using PKAX to unarc things instead of Arc.  Zip will probably also
come out with a CLI version to complement its present Workbench-only version.
If Zip eventually wins the Amiga Compression Wars, you might see ConvertII,
to convert all Arc, Zoo, Pak, and Lharc files into Zip files.

 THANKS
--------
     Many red-faced thanks to D.J. James and Harv Laser for finding a major
bug (now fixed) in Convert that I had overlooked...and I thought I had tested
it in every conceivable configuration.
     Thanks also to John Palmer, Jim Cates, Royan Webb, and Brad Webb for
taking the time to test Convert for me, and for their useful comments.

 CLAIMER
---------
     A claimer is the opposite of a disclaimer.  In this litigious day and
age, disclaimers aren't worth the paper or screen pixels they're written on,
and I laugh every time I read one.  Thus I claim full responsibility for any
damages Convert may cause you.  Have your attorney contact me, and we'll see
how much of the 37¢ I have to my name I can part with for damages.  
     Since I think it's absurd to claim any kind of copyright on small script
files like this, Convert is hereby declared public domain.

     -Joel Salazar
      Apr. 1, 1990
      April Fool's Day
      PLINK:  WALRUS
      GENIE:  WALRUS
        CIS:  73557,2347