Copying Files
It's possible to copy files between archives by extracting them from the source and then adding them to the destination. With file attribute preservation this can yield very good results in most situations. It is, however, less convenient than simply copying files from one archive to another.
The copy command copies a list of files and directories from one archive to another. For example:
cp2 copy fileconv/test-files.sdk Docs:TEACH.SAMPLE Code:LISA mydisk.po
copying Docs/TEACH.SAMPLE copying Docs/TEACH.SAMPLE (rsrc) copying Code/LISA/LISA3.9 copying Code/LISA/ANIX.LISTING copying Code/LISA/anix.equates copying Code/LISA/LISA.MNEMONICS copying Code/LISA/DETOKEN.A copying Code/LISA/MNEMONICS.A
Note the destination archive is the last argument (similar to the way commands like cp work).
To copy all files, omit the file list. This is a simple way to convert a disk image to a file archive and vice-versa.
Text files copied to or from a DOS filesystem will be converted to or from high ASCII. This can be controlled with the --convert-dos-text option.
You cannot use this to duplicate files within a single archive. The source and destination must reference different files.
Using Ext-Archive
The source and destination archives are both interpreted as ext-archive specifications. You can use this to copy a set of files from an arbitrary location in one archive to another. For example, the "turducken" example we used earlier has a couple of files in the directory Dir2, which is in the directory Dir1, on an HFS partition of an APM multi-part volume. Suppose we want to copy all of those files into the directory "FunStuff/GoesHere" on a ProDOS disk:
cp2 copy turducken/MultiPart.hdv:2:Dir1:Dir2 mydisk.po:FunStuff:GoesHere
copying Dir1:Dir2:new-init.do -> Funstuff/GoesHere/new.init.do copying Dir1:Dir2:Samples.BXY -> Funstuff/GoesHere/Samples.BXY
If we had specified the source archive as turducken/MultiPart.hdv:2:Dir1, and then added Dir2 as an argument, we would have made a copy of Dir2 as well as its contents:
cp2 copy turducken/MultiPart.hdv:2:Dir1 Dir2 mydisk.po:FunStuff:GoesHere
copying Dir1:Dir2:new-init.do -> Funstuff/GoesHere/Dir2/new.init.do copying Dir1:Dir2:Samples.BXY -> Funstuff/GoesHere/Dir2/Samples.BXY
The ext-archive argument can thus be used to alter the "root" of both the source and destination.