# unzipsfx(1) - man - phpMan

[UNZIPSFX(1)](https://www.chedong.com/phpMan.php/man/UNZIPSFX/1/markdown)                            General Commands Manual                           [UNZIPSFX(1)](https://www.chedong.com/phpMan.php/man/UNZIPSFX/1/markdown)



## NAME
       unzipsfx - self-extracting stub for prepending to ZIP archives

## SYNOPSIS
       **<name** **of** **unzipsfx+archive** **combo>** [**-cfptuz**[**ajnoqsCLV$**]] [_file(s)_ ... [**-x** _xfile(s)_ ...]]

## DESCRIPTION
       _unzipsfx_  is a modified version of [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) designed to be prepended to existing ZIP archives
       in order to form self-extracting archives.  Instead of taking its first non-flag argument  to
       be  the  zipfile(s) to be extracted, _unzipsfx_ seeks itself under the name by which it was in‐
       voked and tests or extracts the contents of the appended  archive.   Because  the  executable
       stub  adds  bulk to the archive (the whole purpose of which is to be as small as possible), a
       number of the less-vital capabilities in regular _unzip_ have been removed.   Among  these  are
       the  usage (or help) screen, the listing and diagnostic functions (**-l** and **-v**), the ability to
       decompress older compression formats (the ``reduce,'' ``shrink''  and  ``implode''  methods).
       The  ability  to  extract to a directory other than the current one can be selected as a com‐
       pile-time option, which is now enabled by default since UnZipSFX version 5.5.  Similarly, de‐
       cryption  is supported as a compile-time option but should be avoided unless the attached ar‐
       chive contains encrypted files. Starting with release 5.5, another compile-time option adds a
       simple ``run command after extraction'' feature.  This feature is currently incompatible with
       the ``extract to different directory'' feature and remains disabled by default.

       **Note** **that** **self-extracting** **archives** **made** **with** _unzipsfx_ **are** **no** **more** **(or** **less)**  **portable**  **across**
       **different**  **operating** **systems** **than** **is** **the** _unzip_ **executable** **itself.**  In general a self-extract‐
       ing archive made on a particular Unix system, for example, will only self-extract  under  the
       same flavor of Unix.  Regular _unzip_ may still be used to extract the embedded archive as with
       any normal zipfile, although it will generate a harmless warning about extra bytes at the be‐
       ginning  of  the  zipfile.  _Despite_ _this_, however, the self-extracting archive is technically
       _not_ a valid ZIP archive, and PKUNZIP may be unable to test or extract it.  This limitation is
       due  to  the simplistic manner in which the archive is created; the internal directory struc‐
       ture is not updated to reflect the extra bytes prepended to the original zipfile.

## ARGUMENTS
       [_file(s)_]
              An optional list of archive members to be processed.  Regular expressions  (wildcards)
              similar  to those in Unix [_egrep_(1)](https://www.chedong.com/phpMan.php/man/egrep/1/markdown) may be used to match multiple members.  These wild‐
              cards may contain:

              *      matches a sequence of 0 or more characters

              ?      matches exactly 1 character

              [...]  matches any single character found inside the brackets; ranges are specified by
                     a  beginning  character,  a hyphen, and an ending character.  If an exclamation
                     point or a caret (`!' or `^') follows the left bracket, then the range of char‐
                     acters  within the brackets is complemented (that is, anything _except_ the char‐
                     acters inside the brackets is considered a match).

              (Be sure to quote any character that might otherwise be interpreted or modified by the
              operating system, particularly under Unix and VMS.)

       [**-x** _xfile(s)_]
              An  optional  list  of archive members to be excluded from processing.  Since wildcard
              characters match directory separators (`/'), this option may be used  to  exclude  any
              files that are in subdirectories.  For example, ``foosfx *.[ch] -x */*'' would extract
              all C source files in the main directory, but none in any subdirectories.  Without the
              **-x**  option,  all  C  source  files  in all directories within the zipfile would be ex‐
              tracted.

       If _unzipsfx_ is compiled with SFX_EXDIR defined, the following option is also enabled:

       [**-d** _exdir_]
              An optional directory to which to extract files.  By default, all files and  subdirec‐
              tories  are  recreated in the current directory; the **-d** option allows extraction in an
              arbitrary directory (always assuming one has permission to write  to  the  directory).
              The option and directory may be concatenated without any white space between them, but
              note that this may cause normal shell  behavior  to  be  suppressed.   In  particular,
              ``-d ~''  (tilde) is expanded by Unix C shells into the name of the user's home direc‐
              tory, but ``-d~'' is treated as a literal subdirectory ``**~**'' of the current directory.

## OPTIONS
       _unzipsfx_ supports the following [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) options:   **-c**  and  **-p**  (extract  to  standard  out‐
       put/screen), **-f** and **-u** (freshen and update existing files upon extraction), **-t** (test archive)
       and **-z** (print archive comment).  All normal listing options (**-l**, **-v** and  **-Z**)  have  been  re‐
       moved,  but  the testing option (**-t**) may be used as a ``poor man's'' listing.  Alternatively,
       those creating self-extracting archives may wish to include a short listing  in  the  zipfile
       comment.

       See [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) for a more complete description of these options.

## MODIFIERS
       _unzipsfx_ currently supports all [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) modifiers:  **-a** (convert text files), **-n** (never over‐
       write), **-o** (overwrite without prompting), **-q** (operate quietly), **-C** (match names case-insensi‐
       tively), **-L** (convert uppercase-OS names to lowercase), **-j** (junk paths) and **-V** (retain version
       numbers); plus the following operating-system specific options:  **-X** (restore  VMS  owner/pro‐
       tection  info),  **-s**  (convert spaces in filenames to underscores [DOS, OS/2, NT]) and **-$** (re‐
       store volume label [DOS, OS/2, NT, Amiga]).

       (Support for regular ASCII text-conversion may be removed in future  versions,  since  it  is
       simple enough for the archive's creator to ensure that text files have the appropriate format
       for the local OS.  EBCDIC conversion will of course continue to be supported since  the  zip‐
       file format implies ASCII storage of text files.)

       See [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) for a more complete description of these modifiers.

## ENVIRONMENT OPTIONS
       _unzipsfx_  uses the same environment variables as [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) does, although this is likely to be
       an issue only for the person creating and testing the self-extracting archive.  See  [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown)
       for details.

## DECRYPTION
       Decryption  is  supported  exactly  as in [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown); that is, interactively with a non-echoing
       prompt for the password(s).  See [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) for details.  Once again, note that if the  archive
       has  no  encrypted files there is no reason to use a version of _unzipsfx_ with decryption sup‐
       port; that only adds to the size of the archive.

## AUTORUN COMMAND
       When _unzipsfx_ was compiled with CHEAP_SFX_AUTORUN defined, a simple ``command autorun''  fea‐
       ture  is supported. You may enter a command into the Zip archive comment, using the following
       format:

       $AUTORUN$>[command line string]

       When _unzipsfx_ recognizes the ``$AUTORUN$>'' token at the beginning of the  Zip  archive  com‐
       ment,  the  remainder of the first line of the comment (until the first newline character) is
       passed as a shell command to the operating system using the C rtl ``system'' function. Before
       executing  the command, _unzipsfx_ displays the command on the console and prompts the user for
       confirmation.  When the user has switched off prompting by specifying the **-q** option,  autorun
       commands are never executed.

       In  case  the archive comment contains additional lines of text, the remainder of the archive
       comment following the first line is displayed normally, unless quiet operation was  requested
       by supplying a **-q** option.

## EXAMPLES
       To create a self-extracting archive _letters_ from a regular zipfile _letters.zip_ and change the
       new archive's permissions to be world-executable under Unix:

       cat unzipsfx letters.zip > letters
       chmod 755 letters
       zip -A letters

       To create the same archive under MS-DOS, OS/2 or NT (note the use of the **/b**  [binary]  option
       to the _copy_ command):

       copy /b unzipsfx.exe+letters.zip letters.exe
       zip -A letters.exe

       Under VMS:

       copy unzipsfx.exe,letters.zip letters.exe
       letters == "$currentdisk:[currentdir]letters.exe"
       zip -A letters.exe

       (The  VMS  _append_ command may also be used.  The second command installs the new program as a
       ``foreign command'' capable of taking arguments.  The third line assumes that Zip is  already
       installed as a foreign command.)  Under AmigaDOS:

       MakeSFX letters letters.zip UnZipSFX

       (MakeSFX  is included with the UnZip source distribution and with Amiga binary distributions.
       ``zip -A'' doesn't work on Amiga self-extracting archives.)  To test (or list) the newly cre‐
       ated self-extracting archive:

       letters -t

       To test _letters_ quietly, printing only a summary message indicating whether the archive is OK
       or not:

       letters -tqq

       To extract the complete contents into the current directory, recreating all files and  subdi‐
       rectories as necessary:

       letters

       To extract all *.txt files (in Unix quote the `*'):

       letters *.txt

       To extract everything _except_ the *.txt files:

       letters -x *.txt

       To extract only the README file to standard output (the screen):

       letters -c README

       To print only the zipfile comment:

       letters -z

## LIMITATIONS
       The principle and fundamental limitation of _unzipsfx_ is that it is not portable across archi‐
       tectures or operating systems, and therefore neither are the resulting  archives.   For  some
       architectures  there  is  limited  portability, however (e.g., between some flavors of Intel-
       based Unix).

       Another problem with the current implementation is that any archive with  ``junk''  prepended
       to the beginning technically is no longer a zipfile (unless [_zip_(1)](https://www.chedong.com/phpMan.php/man/zip/1/markdown) is used to adjust the zip‐
       file offsets appropriately, as noted above).  [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) takes note of the prepended bytes  and
       ignores them since some file-transfer protocols, notably MacBinary, are also known to prepend
       junk.  But PKWARE's archiver suite may not be able to deal with the modified  archive  unless
       its offsets have been adjusted.

       _unzipsfx_  has no knowledge of the user's PATH, so in general an archive must either be in the
       current directory when it is invoked, or else a full or relative path must be  given.   If  a
       user attempts to extract the archive from a directory in the PATH other than the current one,
       _unzipsfx_ will print a warning to the effect, ``can't find myself.''  This is always true  un‐
       der  Unix  and may be true in some cases under MS-DOS, depending on the compiler used (Micro‐
       soft C fully qualifies the program name, but other compilers may not).   Under  OS/2  and  NT
       there  are  operating-system  calls available that provide the full path name, so the archive
       may be invoked from anywhere in the user's path.  The situation is not  known  for  AmigaDOS,
       Atari TOS, MacOS, etc.

       As  noted above, a number of the normal [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) functions have been removed in order to make
       _unzipsfx_ smaller:  usage and diagnostic info, listing functions and extraction to  other  di‐
       rectories.   Also,  only  stored  and deflated files are supported.  The latter limitation is
       mainly relevant to those who create SFX archives, however.

       VMS users must know how to set up self-extracting archives as foreign commands  in  order  to
       use  any of _unzipsfx_'s options.  This is not necessary for simple extraction, but the command
       to do so then becomes, e.g., ``run letters'' (to continue the examples given above).

       _unzipsfx_ on the Amiga requires the use of a special program,  MakeSFX,  in  order  to  create
       working  self-extracting archives; simple concatenation does not work.  (For technically ori‐
       ented users, the attached archive is defined as a ``debug hunk.'')  There may be  compatibil‐
       ity problems between the ROM levels of older Amigas and newer ones.

       All current bugs in [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) exist in _unzipsfx_ as well.

## DIAGNOSTICS
       _unzipsfx_'s  exit status (error level) is identical to that of [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown); see the corresponding
       man page.

## SEE ALSO
       [_funzip_(1)](https://www.chedong.com/phpMan.php/man/funzip/1/markdown), [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown), [_zip_(1)](https://www.chedong.com/phpMan.php/man/zip/1/markdown), [_zipcloak_(1)](https://www.chedong.com/phpMan.php/man/zipcloak/1/markdown), [_zipgrep_(1)](https://www.chedong.com/phpMan.php/man/zipgrep/1/markdown), [_zipinfo_(1)](https://www.chedong.com/phpMan.php/man/zipinfo/1/markdown), [_zipnote_(1)](https://www.chedong.com/phpMan.php/man/zipnote/1/markdown), [_zipsplit_(1)](https://www.chedong.com/phpMan.php/man/zipsplit/1/markdown)

## URL
       The Info-ZIP home page is currently at
       <http://www.info-zip.org/pub/infozip/>
       or
       ftp://ftp.info-zip.org/pub/infozip/ .

## AUTHORS
       Greg Roelofs was responsible for the basic modifications to UnZip  necessary  to  create  Un‐
       ZipSFX.   See  [_unzip_(1)](https://www.chedong.com/phpMan.php/man/unzip/1/markdown) for the current list of Zip-Bugs authors, or the file CONTRIBS in the
       UnZip source distribution for the full list of Info-ZIP contributors.



Info-ZIP                                20 April 2009 (v6.0)                             [UNZIPSFX(1)](https://www.chedong.com/phpMan.php/man/UNZIPSFX/1/markdown)
