Home Explore Blog CI



man-pages

24th chunk of `zip.man`
8b2d4a03bbba62720457e8278bb00f8973a4a72a7f457cfc0000000100000fc8
 --copy-entries
              Copy entries from one archive to another.  Requires the --out op‐
              tion to specify a different output file than the  input  archive.
              Copy mode is the reverse of -d delete.  When delete is being used
              with --out, the selected entries are deleted from the archive and
              all  other entries are copied to the new archive, while copy mode
              selects the files to include in the new archive.  Unlike  -u  up‐
              date,  input  patterns  on  the  command line are matched against
              archive entries only and not the  file  system  files.   For  in‐
              stance,

                     zip inarchive "*.c" ‐‐copy ‐‐out outarchive

              copies  entries  with  names  ending in .c from inarchive to out‐
              archive.  The wildcard must be escaped on some systems to prevent
              the shell from substituting names of files from the  file  system
              which may have no relevance to the entries in the archive.

              If  no  input files appear on the command line and --out is used,
              copy mode is assumed:

                     zip inarchive ‐‐out outarchive

              This is useful for changing split size for instance.   Encrypting
              and decrypting entries is not yet supported using copy mode.  Use
              zipcloak for that.

       -UN v
       --unicode v
              Determine  what  zip should do with Unicode file names.  zip 3.0,
              in addition to the standard file path,  now  includes  the  UTF-8
              translation  of  the path if the entry path is not entirely 7‐bit
              ASCII.  When an entry is missing the Unicode  path,  zip  reverts
              back to the standard file path.  The problem with using the stan‐
              dard  path  is this path is in the local character set of the zip
              that created the entry, which may contain characters that are not
              valid in the character set being used by the unzip.  When zip  is
              reading  an archive, if an entry also has a Unicode path, zip now
              defaults to using the Unicode path to recreate the standard  path
              using the current local character set.

              This option can be used to determine what zip should do with this
              path  if there is a mismatch between the stored standard path and
              the stored UTF‐8 path (which can happen if the standard path  was
              updated).   In  all  cases,  if there is a mismatch it is assumed
              that the standard path is more current and zip uses that.  Values
              for v are

                     q - quit if paths do not match

                     w - warn, continue with standard path

                     i - ignore, continue with standard path

                     n - no Unicode, do not use Unicode paths

              The default is to warn and continue.

              Characters that are not valid in the current  character  set  are
              escaped as #Uxxxx and #Lxxxxxx, where x is an ASCII character for
              a  hex  digit.  The first is used if a 16‐bit character number is
              sufficient to represent the Unicode character and the  second  if
              the  character  needs more than 16 bits to represent it’s Unicode
              character code.  Setting -UN to

                     e - escape

              as in

                     zip archive ‐sU ‐UN=e

              forces zip to escape all characters that are not printable  7‐bit
              ASCII.

              Normally  zip stores UTF-8 directly in the standard path field on
              systems where UTF-8 is the current character set and  stores  the
              UTF-8 in the new extra fields otherwise.  The option

                     u - UTF-8

              as in

                     zip archive dir ‐r ‐UN=UTF8

Title: zip Options: -U (cont.), -UN
Summary
This section continues the explanation of the '-U' option, detailing its copy mode and how it works with --out. It also introduces the '-UN' option for handling Unicode file names. '-UN' allows users to define how zip deals with mismatches between standard and UTF-8 paths, including options to quit, warn, ignore, or avoid Unicode paths. It also describes how to escape non-valid characters and force UTF-8 encoding in the standard path field.