BNAMEb ZIP - package and compress (archive) files BSYNOPSISb BCHAINb "zip Izipfilei [Iinpathi] [B-# -D -g -nodir -q -r -resume B-Xb] [B-i@bIincludefilei] [B-ppb Ipathi] [B-Sb Isuffixfilei] [B-tb Idatei] [B-quitb Iquitcmdi]" or B*zipb Izipfilei [Iinpathi] [B-# -D -g -nodir -q -r -resume B-Xb] [B-i@bIincludefilei] [B-ppb Ipathi] [B-Sb Isuffixfilei] [B-tb Idatei] [B-quitb Iquitcmdi] BDESCRIPTIONb Izipi is a compression and file packaging utility for Unix, VMS, MSDOS, OS/2, CP/M, Windows NT, Minix, Atari, Macintosh, Amiga, Acorn RISC OS and Acorn BBC. A companion program (unzip(1)), unpacks zip archives. The zip and unzip(1) programs can work with archives produced by PKZIP and Archive(1), and PKZIP, PKUNZIP and Archive can work with archives produced by zip. zip version 1.xx is compatible with PKZIP 2.04 and later and Archive 2.16 and later. Note that PKUNZIP 1.10 cannot extract files produced by PKZIP 2.04 or zip. You must use PKUNZIP 2.04g (or later versions) to extract them. The program is useful for packaging a set of files for distribution; for archiving files; and for saving disk space by temporarily compressing unused files or directories. This describes the BBC version of zip which aims to replicate the behaviour of InfoZip zip v3. It does not compress files, just archives them, unless helped by SparkFS. BARGUMENTSb Izipfilei filename of the zipfile to create. The zipfile will be typed to Archive (&DDC). On the Master and RISC OS the zipfile can have a I-fsname-i or Ifsname:i prefix to specify the filing system the file is on. Iinpathi Path to include. If Iinpathi is a directory, then all files within that directory will be included. If Iinpathi is a file, just that single file will be included. If Iinpathi contains wildcards then it will use only the first matching object. BOPTIONSb Options supplied to the BBC version of zip must each be specified singly. This is different to other platforms where multiple options can be run together. B-?b Display the zip command line syntax. B-Db Do not create entries in the zip archive for directories. Directory entries are created by default so that their attributes can be saved in the zip archive. B-gb Grow existing zipfile by appending to it. If the existing zipfile is truncated it will be appended to after the last valid entry. B-i@bIfilenamei Include the files listed in the file specified by Ifilenamei. If no filename is given, the filenames are read from the input stream. B-nodirb Do not add a zip catalogue to the end of the zipfile. The final file only contains the stored entries with their inline metadata. This will shorten the zipfile by something like 10%-15% depending on contents, but some unzip tools may not be able to extract the contents. BBC unzip does extract the contents as it ignores the zip catalogue and uses the inline metadata. B-ppb Ipathi Prepends the specified path onto the stored filename in the archive. This allows the entries within an archive to appear to be within the specified directory. For example: *zip outfile infile -pp DirName will store Iinfilei in the archive, where it will be called IDirName.infilei. B-qb Quiet mode. All output messages are disabled. B-quitb Iquitcmdi Command to execute on termination. This allows zip to be called and then continue to a specified program. If Iquitcmdi starts with a '*' it is called as a *command, otherwise it is CHAINed. B-rb Travel the directory structure recursively, for example: *zip outfile indir -r In this case, all the files and directories in Iindiri are saved in a zip archive named Ioutfilei. B-resumeb Restarts an aborted zip session by appending to the zipfile, scanning through it and finding the last entry successfully added and then continuing to add files from that point onwards. This way an aborted zip session can be restarted at the file that was being added when the previous session terminated. B-Sb Isuffixfilei Specifies a text file containing a list of file extensions to map to file types, commonly called a MimeMap file. If this is specified then files added to the zip file which have truncated file extentions will have those extensions extended according to their filetype. For instance, the file Imainpage/hi will be stored as Imainpage/htmi (translated to Imainpage.htmi) if it is filetyped to &FAF and the suffixfile contains the entry 'FAF,htm'. B-tb Idatei Only include files that were modified on the specified date or later. The date is specified as dd/mm/yyyy or yyyy/mm/dd. B-Xb Include extra file information. By default zip stores a object's load and execution address, access permissions, and the modification date and time. This option will include all the additional metadata associated with objects stored on SJ MDFS file servers and with filing systems such as HADFS, this being the creation date and time, main account and auxillary acount. B-bI#i Specify the compression type used, where B-0b is no compression (store all files) and B-8b is deflate. BBCZip will compress files if used on RISC OS with SparkFS running. Otherwise, any B-bI#i option is ignored and BBCZip stores files. As a special option B-255b causes zip to store only objects' metadata and no data. BEXAMPLESb The simplest example: *zip stuff things creates the archive Istuffi and puts all the files in the directory Ithingsi in it. This will not include any subdirectories from the directory. To do this, the command: *zip stuff -r things creates the archive Istuffi, containing all the files and directories in directory Ithingsi. The use of the B-ppb option allows the entries within the archive to be named as being in a specified directory. For example: *zip BBCZip/zip BBCZip -r -pp Software.Archivers.BBCZip will archive the entries within the directory IBBCZipi and within the archive the entries will appear to be within a directory named ISoftware.Archivers.BBCZipi. Using this small parts of a directory tree can be archived without the whole directory tree having to be archived. The B-i@b option allows a list of files in a textfile to be archived. For example: *zip Update/zip :Docs.$ -i@uplist will create the archive IUpdate/zipi containing only those files in directory I:Docs.$i that are listed in the text file Iuplisti. This option is useful when creating an update archive based on a comparison with another archive. The lines in the include file must be terminated with s. Note that there is no space between the 'B-i@b' option and the filename. Using B-@b with no filename will read the list of filenames from the current input stream. This can allow you to have an *EXEC file zip up objects from the EXEC file itself. For example, a file containing: *zip ^.man/zip @ -@ man/src man *EXECing this file will start zip and include the files in the current directory listed in the rest of the file. Using the B-Xb option will include all the extra file information that systems such as the SJ MDFS fileserver have. Using: *zip backup1 :SYSTEM.$ -r -X -pp :SYSTEM.$ will create an archive of everything on the disk ISYSTEMi including all the additional file information, and including the name of the source directory in the archive entry names. This archive can be unzipped to completely restore all the files on disk ISYSTEMi along with all the associated file information using: *unzip backup1 -X Note that to do this the appropriate user privileges will be required. The B-tb option gives the ability to make incremental zip archives, zipping up only files that have been modified after a certain date. As an example, extending the previous example to: *zip backup1 :SYSTEM.$ -r -X -t 01/12/1999 -pp :SYSTEM.$ would zip up only those files that were last modified on 1st December 1999 or later. Note that you shouldn't try to create the zipfile within the directory structure that you specify to include in the zipfile otherwise Izipi will attempt to include the zipfile within itself. For example: *zip stuff @ will create the zipfile Istuffi within the current directory, and try to include within it all the files within the current directory, including the zipfile. BTECHNICAL INFORMATIONb ZIP files include an extras field that holds metadata specific to particular systems. Acorn metadata is stored in the extras field in the following format: 0 extra header id 2 bytes "AC" 2 extra header sublength 2 bytes ------------v 4 Acorn header id 4 bytes "ARC0" 4 8 load address 4 bytes 8 12 execution address 4 bytes 12 16 attributes 4 bytes 16 20 &00000000 4 bytes 20 24 creation time 2 bytes 22 26 creation date 2 bytes 24 28 main account number 2 bytes 26 30 auxilary account number 2 bytes 28 Only that metadata specified by the header sublength is present. Any metadata that is omitted results in UnZip not setting that metadata on extracted objects. If the execution address is missing, but the load address is present, it is assumed to be the same as the load address. Creation and modification times and dates are stored in MS-DOS format. BBCZip bidirectionally swaps the following filename characters: I.i <-> I/i I#i <-> I?i I$i <-> I<i I^i <-> I>i I@i <-> I=i When appending with the -resume option BBCZip puts a "PK",&0F,&10 'FileOpen' header at the start of the output file, followed by the offset to the last correctly-added entry. This allows the B-resumeb option to quickly find the last entry. This header is replaced with a "PK",&03,&04 header when the file is finalised. BNOTESb zip 1.xx does not compress files, just stores. The -X switch is slightly non-symetrical between Zip and UnZip: BZipb stores just the common Acorn metadata, load/exec addresses, attributes and modification date/time BZip -Xb stores all available metadata on the source filing system BUnZipb extracts all stored metadata except any account numbers BUnZip -Xb extracts all stored metadata and any account numbers If running in an environment where SparkFS is available, then compression is available by calling *ZipCompress. zip attempts to find additional file metadata by using OSFILE &FD, NetFS_Op 18,64 and NetFS_Op 18,65. There is a bug in the CmdLine library used by zip where any hyphen is seen as introducing an option, for example BZip -ramfs-outb or BZip new-runb is seen as the B-rb option. This can be worked around by using upper case for the file name, eg I-RAMFS-outi or a colon filing system prefix, eg Iramfs:outi. Need to do: Some way of storing metadata on start directory, so Bzip out $ -rb stores infomation about I$i. Store 'P' bit from MDFS Is DefAccess info readable from MDFS? BSEE ALSOb Archive(1), UnZip(1), UnZip(9), Zip(1), Zip(5), Zip(9), ZipCat(1), ZipDiff(1), ZipEx(1), ZipInfo(1). BAUTHORb J.G.Harston