📄 zip.1
字号:
option of \fIzip\fR..TP.B \-gGrow (append to) the specified.I ziparchive, instead of creating a new one. If this operation fails,.I zipattempts to restore the archive to its original state. If the restorationfails, the archive might become corrupted. This option is ignored whenthere's no existing archive or when at least one archive member must beupdated or deleted..TP.B \-hDisplay the.I ziphelp information (this also appears if.I zipis run with no arguments)..TP.BI \-i\ filesInclude only the specified files, as in:.RS.IP\fCzip -r foo . -i \\*.c\fP.RE.IPwhich will include only the files that end in.IR \& .cin the current directory and its subdirectories. (Note for PKZIPusers: the equivalent command is.RS.IP\fCpkzip -rP foo *.c\fP.RE.IPPKZIP does not allow recursion in directories other than the current one.)The backslash avoids the shell filename substitution, so that thename matching is performed by.I zipat all directory levels. Not escaping wildcards on shells that dowildcard substitution before \fIzip\fR gets the command line may seem towork but files in subdirectories matching the pattern will never bechecked and so not matched. For shells, such as Win32 commandprompts, that do not replace file patterns containing wildcardswith the respective file names,.I zipwill do the recursion and escaping the wildcards is not needed..IPAlso possible:.RS.IP\fCzip -r foo . -i@include.lst\fP.RE.IPwhich will only include the files in the current directory and itssubdirectories that match the patterns in the file include.lst, one filepattern per line..TP.B \-I[Acorn RISC OS] Don't scan through Image files. When used,.I zipwill notconsider Image files (eg. DOS partitions or Spark archives when SparkFSis loaded) as directories but will store them as single files..IPFor example, if you have SparkFS loaded, zipping a Spark archive will resultin a zipfile containing a directory (and its content) while using the 'I'option will result in a zipfile containing a Spark archive. Obviously thissecond case will also be obtained (without the 'I' option) if SparkFS isn'tloaded..TP.B \-jStore just the name of a saved file (junk the path), and do not storedirectory names. By default,.I zipwill store the full path (relative to the current path)..TP.B \-jj[MacOS] record Fullpath (+ Volname). The complete path includingvolume will be stored. By default the relative path will be stored..TP.B \-JStrip any prepended data (e.g. a SFX stub) from the archive..TP.B \-kAttempt to convert the names and paths to conform to MSDOS,store only the MSDOS attribute (just the user write attribute from UNIX),and mark the entry as made under MSDOS (even though it was not);for compatibility with PKUNZIP under MSDOS which cannot handle certainnames such as those with two dots..TP.B \-lTranslate the Unix end-of-line character LF into theMSDOS convention CR LF. This option should not be used on binary files.This option can be used on Unix if the zip file is intended for PKUNZIPunder MSDOS. If the input files already contain CR LF, this option addsan extra CR. This ensures that.I unzip \-aon Unix will get back an exact copy of the original file,to undo the effect of \fIzip \-l\fR.See the note on binary detection for.B \-llbelow..TP.B \-llTranslate the MSDOS end-of-line CR LF into Unix LF.This option should not be used on binary files and a warning will beissued when a file is converted that later is detected to be binary.This option can be used on MSDOS if the zip file is intended for unzipunder Unix..IPIn Zip 2.31 and later, binary detection has been changed from a simplepercentage of binary characters being considered binary to a more selectivemethod that should consider files in many character sets,including \fIUTF-8\fP, that only include text characters in that characterset to be text.This allows.I unzip -ato convert these files..TP.B \-LDisplay the.I ziplicense..TP.B \-mMove the specified files into the.I ziparchive; actually,this deletes the target directories/files after making the specified.I ziparchive. If a directory becomes empty after removal of the files, thedirectory is also removed. No deletions are done until.I ziphas created the archive without error.This is useful for conserving disk space,but is potentially dangerous so it is recommended to use it incombination with.B \-Tto test the archive before removing all input files..TP.B \-MMAll input patterns must match at least one file and all input filesfound must be readable. Normally when an input pattern does not matcha file the "name not matched" warning is issued and when an input filehas been found but later is missing or not readable a missing or notreadable warning is issued. In either case.I zipcontinues creating the archive, with missing or unreadable new filesbeing skipped and files already in the archive remaining unchanged.After the archive is created, if any files were not readable.I zipreturns the OPEN error code (18 on most systems) instead of the normalsuccess return (0 on most systems). With.B \-MMset,.I zipexits as soon as an input pattern is not matched (whenever the"name not matched" warning would be issued) or when an input file isnot readable. In either case \fIzip\fR exits with an OPEN errorand no archive is created..IPThis option is useful when a known list of files is to be zipped soany missing or unreadable files will result in an error. It is lessuseful when used with wildcards, but \fIzip\fR will still exit with anerror if any input pattern doesn't match at least one file and if anymatched files are unreadable. If you want to create the archiveanyway and only need to know if files were skipped, don't use.B \-MMand just check the return code..TP.BI \-n\ suffixesDo not attempt to compress files named with the given\fBsuffixes\fR.Such files are simply stored (0% compression) in the output zip file,so that.I zipdoesn't waste its time trying to compress them.The suffixes are separated byeither colons or semicolons. For example:.RS.IP\fCzip -rn .Z:.zip:.tiff:.gif:.snd foo foo\fP.RE.IPwill copy everything from.I foointo.IR foo.zip ,but will store any files that end in.IR .Z ,.IR .zip ,.IR .tiff ,.IR .gif ,or.I .sndwithout trying to compress them(image and sound files often have their own specialized compression methods).By default,.I zipdoes not compress files with extensions in the list.I .Z:.zip:.zoo:.arc:.lzh:.arj.Such files are stored directly in the output archive.The environment variable ZIPOPT can be used to change the default options. Forexample under Unix with csh:.RS.IP\fCsetenv ZIPOPT "-n .gif:.zip"\fP.RE.IPTo attempt compression on all files, use:.RS.IP\fCzip -n : foo\fP.RE.IPThe maximum compression option.B \-9also attempts compression on all files regardless of extension..IPOn Acorn RISC OS systems the suffixes are actually filetypes (3 hex digitformat). By default, zip does not compress files with filetypes in the listDDC:D96:68E (i.e. Archives, CFS files and PackDir files)..TP.B \-N[Amiga, MacOS] Save Amiga or MacOS filenotes as zipfile comments. They can berestored by using the.B \-Noption of unzip. If.B \-cis used also, you are prompted for comments only for those files that do nothave filenotes..TP.B \-oSet the "last modified" time of the.I ziparchive to the latest (oldest) "last modified" timefound among the entries in the.I ziparchive.This can be used without any other operations, if desired.For example:.RS.IP\fCzip -o foo\fP.RE.IPwill change the last modified time of.I foo.zipto the latest time of the entries in.IR foo.zip ..TP\fB\-P\fP\ \fIpassword\fPuse \fIpassword\fP to encrypt zipfile entries (if any). \fBTHIS ISINSECURE!\fP Many multi-user operating systems provide ways for any user tosee the current command line of any other user; even on stand-alone systemsthere is always the threat of over-the-shoulder peeking. Storing the plaintextpassword as part of a command line in an automated script is even worse.Whenever possible, use the non-echoing, interactive prompt to enter passwords.(And where security is truly important, use strong encryption such as PrettyGood Privacy instead of the relatively weak encryption provided by standardzipfile utilities.).TP.B \-qQuiet mode;eliminate informational messages and comment prompts.(Useful, for example, in shell scripts and background tasks)..TP.BI \-Qn[QDOS] store information about the file in the file header with n defined as.RSbit 0: Don't add headers for any file.RE.RSbit 1: Add headers for all files.RE.RSbit 2: Don't wait for interactive key press on exit.RE.TP.B \-rTravel the directory structure recursively;for example:.RS.IP\fCzip -r foo.zip foo\fP.RE.IPor a bit more concisely.RS.IP\fCzip -r foo foo\fP.RE.IPIn this case, all the files and directories in.I fooare saved in a.I ziparchive named.IR foo.zip ,including files with names starting with ".",since the recursion does not use the shell's file-name substitution mechanism.If you wish to include only a specific subset of the files in directory.I fooand its subdirectories, use the.B \-ioption to specify the pattern of files to be included.You should not use.B \-rwith the name ".*",since that matches ".."which will attempt to zip up the parent directory(probably not what was intended)..TP.B \-RTravel the directory structure recursively starting at thecurrent directory;for example:.RS.IP\fCzip -R foo '*.c'\fP.RE.IPIn this case, all the files matching *.c in the tree starting at thecurrent directory are stored into a.I ziparchive named.IR foo.zip .Note for PKZIP users: the equivalent command is.RS.IP\fCpkzip -rP foo *.c\fP.RE.TP.B \-S[MSDOS, OS/2, WIN32 and ATARI] Include system and hidden files..RS[MacOS] Includes finder invisible files, which are ignored otherwise..RE.TP.BI \-t\ mmddyyyyDo not operate on files modified prior to the specified date,where.I mmis the month (0-12),.I ddis the day of the month (1-31),and.I yyyyis the year.The.I ISO 8601date format.I yyyy-mm-ddis also accepted.For example:.RS.IP\fCzip -rt 12071991 infamy foo\fP.IP\fCzip -rt 1991-12-07 infamy foo\fP.RE.IPwill add all the files in.I fooand its subdirectories that were last modified on or after 7 December 1991,to the.I ziparchive.IR infamy.zip ..TP.BI \-tt\ mmddyyyyDo not operate on files modified after or at the specified date,where.I mmis the month (0-12),.I ddis the day of the month (1-31),and.I yyyyis the year.The.I ISO 8601date format.I yyyy-mm-ddis also accepted.For example:.RS.IP\fCzip -rtt 11301995 infamy foo\fP.IP\fCzip -rtt 1995-11-30 infamy foo\fP.RE.IPwill add all the files in.I fooand its subdirectories that were last modified before 30 November 1995,to the.I ziparchive.IR infamy.zip ..TP.B \-TTest the integrity of the new zip file. If the check fails, the old zip fileis unchanged and (with the.B \-moption) no input files are removed..TP.B \-uReplace (update) an existing entry in the.I ziparchive only if it has been modified more recentlythan the version already in the.I ziparchive.For example:.RS.IP\fCzip -u stuff *\fP.RE.IPwill add any new files in the current directory,and update any files which have been modified since the.I ziparchive.I stuff.zipwas last created/modified (note that.I zipwill not try to pack.I stuff.zipinto itself when you do this)..IPNote that the.B \-uoption with no arguments acts like the.B \-f(freshen) option..TP.B \-vVerbose mode or print diagnostic version info..IPNormally, when applied to real operations, this option enables the display of aprogress indicator during compression and requests verbose diagnosticinfo about zipfile structure oddities..IPWhen.B \-vis the only command line argument, and either stdin or stdout isnot redirected to a file,a diagnostic screen is printed. In addition to the help screen headerwith program name, version, and release date, some pointers to the Info-ZIPhome and distribution sites are given. Then, it shows information about thetarget environment (compiler type and version, OS version, compilation dateand the enabled optional features used to create the.I zipexecutable.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -