用shell压缩多个文件夹为zip

2025-03-28 19:39:25
推荐回答(3个)
回答1:

压缩为bcd.zip,保存在a文件夹中,如果要静默模式,zip命令加-q选项。

文件格式:

另指计算机文件压缩算法,原名真空,发明者为菲尔·卡茨,他于1989年1月公布了该格式的资料。

标准 ZIP 压缩文件格式分析:标准 zip 文件格式由三部分组成:zip 压缩数据段、中央目录区、中央目录区尾部。其中 zip 压缩数据段又分为 zip 文件头信息和压缩数据。如图 1、2、3 所示。带☆的是在文件修复中经常用到的。

扩展资料:

命令参数:

Copyright (C) 1990-1999 Info-ZIP

Type 'zip "-L"' for software license。

Zip 2.3 (November 29th 1999). Usage。

zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]。

The default action is to add or replace zipfile entries from list, which。

can include the special name - to compress standard input。

If zipfile and list are omitted, zip compresses stdin to stdout。

-f freshen: only changed files -u update: only changed or new files。

参考资料来源:百度百科-Zip


回答2:

cd a
zip -r bcd b c d

压缩为bcd.zip,保存在a文件夹中。

如果要静默模式,zip命令加-q选项。

 

解压到当前目录:

unzip bcd.zip

回答3:

cd a && tar -czvf a.tar.gz b/* c/* d/*
如果是要zip格式的话这样
zip -r a.zip b c d

参数 -r 递归处理,将指定目录下的所有文件和子目录一并处理。