Adding Files
Files can be added to an archive with the add command. It takes the name of an archive and a list of files and directories as arguments:
cp2 add myfiles.shk sample.text Code/LISA
Created file archive 'myfiles.shk' Adding 8 files adding Code\LISA\anix.equates adding Code\LISA\ANIX.LISTING adding Code\LISA\DETOKEN.A adding Code\LISA\LISA.MNEMONICS adding Code\LISA\LISA3.9 adding Code\LISA\MNEMONICS.A adding sample.text
If the archive name indicates a file archive, and the file does not exist, it will be created automatically.
Attribute Preservation
Files that were extracted with attribute preservation should be added with those attributes. This is generally handled automatically by cp2, which will identify AppleSingle, AppleDouble, NAPS, and (on Mac OS) host-preserved attributes.
cp2 a myfiles.shk TEACH.SAMPLE.as
Adding 1 file adding TEACH.SAMPLE.as -> TEACH.SAMPLE adding TEACH.SAMPLE.as (rsrc) -> TEACH.SAMPLE
Sometimes this is undesirable, e.g. you want an AppleSingle file to be added as an AppleSingle file, not unpacked into its parts. You can switch off individual preservation schemes by adding the --no-from-adf, --no-from-as, --no-from-host, or --no-from-naps flag. You can turn them all off with --no-from-any.
Files added to ZIP archives will use a special arrangement of AppleDouble that puts the "header" files in a separate hierarchy under the __MACOSX directory. You can disable this behavior with --no-mac-zip.
Using Ext-Archive
When working with filesystems on disk images, files and directories are added to the volume directory. Sometimes this isn't desired, e.g. you want to add all files to a subdirectory. You can do this by adding the directory name to the ext-archive specifier.
cp2 cdi newdisk.po 800kb prodos
Creating disk image: Unadorned Sector, order=pdos/blk, size=800KB, ProDOS
cp2 mkdir newdisk.po SubDir
creating SubDir
cp2 a newdisk.po:SubDir TEACH.SAMPLE.as
Adding 1 file adding TEACH.SAMPLE.as -> SubDir/TEACH.SAMPLE adding TEACH.SAMPLE.as (rsrc) -> SubDir/TEACH.SAMPLE