📄 manual
字号:
Also possible: zip -r foo . -i@include.lst which will only include the files in the current directory and its subdirectories that match the patterns in the file include.lst, one file pattern per line. -I [Acorn RISC OS] Don't scan through Image files. When used, zip will not consider Image files (eg. DOS partitions or Spark archives when SparkFS is loaded) as directories but will store them as single files. For example, if you have SparkFS loaded, zipping a Spark archive will result in a zipfile containing a directory (and its con- tent) while using the 'I' option will result in a zipfile con- taining a Spark archive. Obviously this second case will also be obtained (without the 'I' option) if SparkFS isn't loaded. -j Store just the name of a saved file (junk the path), and do not store directory names. By default, zip will store the full path (relative to the current path). -jj [MacOS] record Fullpath (+ Volname). The complete path including volume will be stored. By default the relative path will be stored. -J Strip any prepended data (e.g. a SFX stub) from the archive. -k Attempt 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 certain names such as those with two dots. -l Translate the Unix end-of-line character LF into the MSDOS con- vention 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 PKUNZIP under MSDOS. If the input files already contain CR LF, this option adds an extra CR. This ensures that unzip -a on Unix will get back an exact copy of the original file, to undo the effect of zip -l. See the note on binary detection for -ll below. -ll Translate the MSDOS end-of-line CR LF into Unix LF. This option should not be used on binary files and a warning will be issued 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 unzip under Unix. In Zip 2.31 and later, binary detection has been changed from a simple percentage of binary characters being considered binary to a more selective method that should consider files in many character sets, including UTF-8, that only include text charac- ters in that character set to be text. This allows unzip -a to convert these files. -L Display the zip license. -m Move the specified files into the zip archive; actually, this deletes the target directories/files after making the specified zip archive. If a directory becomes empty after removal of the files, the directory is also removed. No deletions are done until zip has created the archive without error. This is useful for conserving disk space, but is potentially dangerous so it is recommended to use it in combination with -T to test the archive before removing all input files. -MM All input patterns must match at least one file and all input files found must be readable. Normally when an input pattern does not match a file the "name not matched" warning is issued and when an input file has been found but later is missing or not readable a missing or not readable warning is issued. In either case zip continues creating the archive, with missing or unreadable new files being skipped and files already in the archive remaining unchanged. After the archive is created, if any files were not readable zip returns the OPEN error code (18 on most systems) instead of the normal success return (0 on most systems). With -MM set, zip exits as soon as an input pattern is not matched (whenever the "name not matched" warning would be issued) or when an input file is not readable. In either case zip exits with an OPEN error and no archive is created. This option is useful when a known list of files is to be zipped so any missing or unreadable files will result in an error. It is less useful when used with wildcards, but zip will still exit with an error if any input pattern doesn't match at least one file and if any matched files are unreadable. If you want to create the archive anyway and only need to know if files were skipped, don't use -MM and just check the return code. -n suffixes Do not attempt to compress files named with the given suffixes. Such files are simply stored (0% compression) in the output zip file, so that zip doesn't waste its time trying to compress them. The suffixes are separated by either colons or semi- colons. For example: zip -rn .Z:.zip:.tiff:.gif:.snd foo foo will copy everything from foo into foo.zip, but will store any files that end in .Z, .zip, .tiff, .gif, or .snd without trying to compress them (image and sound files often have their own specialized compression methods). By default, zip does not com- press files with extensions in the list .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. For example under Unix with csh: setenv ZIPOPT "-n .gif:.zip" To attempt compression on all files, use: zip -n : foo The maximum compression option -9 also attempts compression on all files regardless of extension. On Acorn RISC OS systems the suffixes are actually filetypes (3 hex digit format). By default, zip does not compress files with filetypes in the list DDC:D96:68E (i.e. Archives, CFS files and PackDir files). -N [Amiga, MacOS] Save Amiga or MacOS filenotes as zipfile com- ments. They can be restored by using the -N option of unzip. If -c is used also, you are prompted for comments only for those files that do not have filenotes. -o Set the "last modified" time of the zip archive to the latest (oldest) "last modified" time found among the entries in the zip archive. This can be used without any other operations, if desired. For example: zip -o foo will change the last modified time of foo.zip to the latest time of the entries in foo.zip. -P password use password to encrypt zipfile entries (if any). THIS IS INSE- CURE! Many multi-user operating systems provide ways for any user to see the current command line of any other user; even on stand-alone systems there is always the threat of over-the- shoulder peeking. Storing the plaintext password as part of a command line in an automated script is even worse. Whenever possible, use the non-echoing, interactive prompt to enter pass- words. (And where security is truly important, use strong encryption such as Pretty Good Privacy instead of the relatively weak encryption provided by standard zipfile utilities.) -q Quiet mode; eliminate informational messages and comment prompts. (Useful, for example, in shell scripts and background tasks). -Qn [QDOS] store information about the file in the file header with n defined as bit 0: Don't add headers for any file bit 1: Add headers for all files bit 2: Don't wait for interactive key press on exit -r Travel the directory structure recursively; for example: zip -r foo.zip foo or a bit more concisely zip -r foo foo In this case, all the files and directories in foo are saved in a zip archive named 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 foo and its subdirectories, use the -i option to specify the pattern of files to be included. You should not use -r with the name ".*", since that matches ".." which will attempt to zip up the parent directory (proba- bly not what was intended). -R Travel the directory structure recursively starting at the cur- rent directory; for example: zip -R foo '*.c' In this case, all the files matching *.c in the tree starting at the current directory are stored into a zip archive named foo.zip. Note for PKZIP users: the equivalent command is pkzip -rP foo *.c -S [MSDOS, OS/2, WIN32 and ATARI] Include system and hidden files. [MacOS] Includes finder invisible files, which are ignored oth- erwise. -t mmddyyyy Do not operate on files modified prior to the specified date, where mm is the month (0-12), dd is the day of the month (1-31), and yyyy is the year. The ISO 8601 date format yyyy-mm-dd is also accepted. For example: zip -rt 12071991 infamy foo zip -rt 1991-12-07 infamy foo will add all the files in foo and its subdirectories that were last modified on or after 7 December 1991, to the zip archive infamy.zip. -tt mmddyyyy Do not operate on files modified after or at the specified date, where mm is the month (0-12), dd is the day of the month (1-31), and yyyy is the year. The ISO 8601 date format yyyy-mm-dd is also accepted. For example: zip -rtt 11301995 infamy foo zip -rtt 1995-11-30 infamy foo will add all the files in foo and its subdirectories that were last modified before 30 November 1995, to the zip archive infamy.zip. -T Test the integrity of the new zip file. If the check fails, the old zip file is unchanged and (with the -m option) no input files are removed. -u Replace (update) an existing entry in the zip archive only if it has been modified more recently than the version already in the zip archive. For example: zip -u stuff * will add any new files in the current directory, and update any files which have been modified since the zip archive stuff.zip was last created/modified (note that zip will not try to pack stuff.zip into itself when you do this). Note that the -u option with no arguments acts like the -f (freshen) option. -v Verbose mode or print diagnostic version info. Normally, when applied to real operations, this option enables the display of a progress indicator during compression and requests verbose diagnostic info about zipfile structure oddi- ties. When -v is the only command line argument, and either stdin or stdout is not redirected to a file, a diagnostic screen is printed. In addition to the help screen header with program name, version, and release date, some pointers to the Info-ZIP home and distribution sites are given. Then, it shows informa- tion about the target environment (compiler type and version, OS version, compilation date and the enabled optional features used to create the zip executable. -V [VMS] Save VMS file attributes and use portable form. zip archives created with this option are truncated at EOF but still may not be usable on other systems depending on the file types being zipped. -VV [VMS] Save VMS file attributes. zip archives created with this option include the entire file and should be able to recreate most VMS files on VMS systems but these archives will generally not be usable on other systems. -w [VMS] Append the version number of the files to the name, including multiple versions of files. (default: use only the most recent version of a specified file). -x files Explicitly exclude the specified files, as in: zip -r foo foo -x \*.o which will include the contents of foo in foo.zip while exclud- ing all the files that end in .o. The backslash avoids the shell filename substitution, so that the name matching is per- formed by zip at all directory levels. If you do not escape wildcards in patterns it may seem to work but files in subdirec- tories will not be checked for matches.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -