免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2520 | 回复: 2
打印 上一主题 下一主题

如何用zip命令将一个文件附加到一个已存在的zip包中? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-06-06 16:58 |只看该作者 |倒序浏览
比如archive.zip已经包含了一些文件,我想将另一个文件new.txt也打包放到archive.zip中,有zip命令可以实现吗?

我的要求是在不解压archive.zip的情况下直接将new.txt压缩到archive.zip中,而不是先解压archive.zip,然后将解压出来的文件和new.txt再次打包。

论坛徽章:
0
2 [报告]
发表于 2012-07-08 16:10 |只看该作者

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
3 [报告]
发表于 2012-07-08 16:30 |只看该作者
本帖最后由 ulovko 于 2012-07-09 07:15 编辑

  1. > man zip
  2.    add
  3.               Update existing entries and add new files.  If the archive  does
  4.               not exist create it.  This is the default mode.
  5. -u
  6.        --update
  7.               Replace (update) an existing entry in the zip archive only if it
  8.               has been modified more recently than the version already in  the
  9.               zip archive.  For example:

  10.                      zip -u stuff *

  11.               will  add any new files in the current directory, and update any
  12.               files which have been modified since the zip  archive  stuff.zip
  13.               was  last  created/modified  (note that zip will not try to pack
  14.               stuff.zip into itself when you do this).

  15.               Note that the -u option with no input file arguments  acts  like
  16.               the -f (freshen) option.


复制代码

  1. > zip bookmarks_12-7-8.html.zip bookmarks_12-7-8.html
  2.   adding: bookmarks_12-7-8.html (deflated 50%)

  3. > unzip -l bookmarks_12-7-8.html.zip
  4. Archive:  bookmarks_12-7-8.html.zip
  5.   Length     Date   Time    Name
  6. --------    ----   ----    ----
  7.    205047  07-08-12 15:36   bookmarks_12-7-8.html
  8. --------                   -------
  9.    205047                   1 file

  10. > zip -u bookmarks_12-7-8.html.zip stopServices.sh
  11.   adding: stopServices.sh (deflated 74%)

  12. > unzip -l bookmarks_12-7-8.html.zip
  13. Archive:  bookmarks_12-7-8.html.zip
  14.   Length     Date   Time    Name
  15. --------    ----   ----    ----
  16.    102214  07-08-12 16:23   bookmarks_12-7-8.html.zip
  17.       607  06-14-12 16:02   stopServices.sh
  18. --------                   -------
  19.    102821                   2 files
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP