更新 Zip 文件
linux – Sync zip file with folder? – Stack Overflow
-FS / –filesync
查看 Zip 文件
View list of files in ZIP archive on Linux – Super User
The less utility is capable of peeking into a zip archive.
In fact, if you look at the outputs of unzip -l zipfile and less zipfile, you will find them to be identical.
忽略目录 / 忽略文件
-x files / –exclude files
- zip -r foo foo -x \*.o \*.c
Q:忽略特殊文件?
A:我们暂时(10/21/2024)未找到忽略特殊文件的命令行选项,需要通过其他方式来处理。
退出状态 | Exit Code
zip(1): package/compress files – Linux man page
0 | normal; no errors or warnings detected.
2 | unexpected end of zip file.
3 | a generic error in the zipfile format was detected. Processing may have completed successfully anyway; some broken zipfiles created by other archivers have simple work-arounds.
4 | zip was unable to allocate memory for one or more buffers during program initialization.
5 | a severe error in the zipfile format was detected. Processing probably failed immediately.
6 | entry too large to be processed (such as input files larger than 2 GB when not using Zip64 or trying to read an existing archive that is too large) or entry too large to be split with zipsplit
7 | invalid comment format
8 | zip -T failed or out of memory
9 | the user aborted zip prematurely with control-C (or similar)
10 | zip encountered an error while using a temp file
11 | read or seek error
12 | zip has nothing to do
13 | missing or empty zip file
14 | error writing to a file
15 | zip was unable to create a file to write to
16 | bad command line parameters
18 | zip could not open a specified file to read
19 | zip was compiled with options not supported on this system
保存文件的元数据 | Metadata
zip – Preserving permissions while zipping – Unix & Linux Stack Exchange
linux – Unzipping file whilst getting correct permissions? – Super User
根据文档描述:
查看文件所有者、所属组、权限
Info-Zip 3.0 SUPPORTS preserving files/dirs UNIX permissions and UID/GID ownership data.
unzip must run as root to set the files/dirs UID/GID.
unzip with the -K flag to also restore SUID/SGID/Sticky bits.
特殊文件的保存
–symlinks | 保存符号连接文件。