如何更新一个zip压缩文件一个文件 [英] How to update one file in a zip archive

查看:165
本文介绍了如何更新一个zip压缩文件一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能取代zip文件中的文件解压没有删除旧文件中添加新的文件和rezipping回来?

Is it possible to replace a file in a zip file without unzipping deleting the old file adding the new file and rezipping it back?

原因是我有一个zip文件,这是非常大的有,我有,有时更新压缩文件内的一个XML。解压ZIP和rezipping这需要很长的时间。所以我想只能够通过一个脚本来代替拉链内一个XML。我已经有一个检查有关XML我有更新。

Reason is I have a zip file which is really big there is one xml inside the zip file that I have to update sometimes. Unzipping the zip and rezipping it takes a long time. So I'd like to just be able to replace the one xml inside the zip through a script. I already have that checks for updates on the xml I have.

那么,这可能只需更换一个XML没有解压和rezipping?

So is it possible to just replace the one xml without unzipping and rezipping ?

对不起,我会用zip命令做这样的事情,但问题是脚本实际上是Android手机和zip不是命令我可以用遗憾的是对不起,我离开了这一点。我会用拉链肯定如果我能,但我只对机器人解压缩,然后有焦油busybox的焦油,但没有做什么,我需要

Sorry i would use the zip command to do things like that but problem is the script is actually for an android phone and zip is not a command i can use unfortunately sorry i left that out. I would have used zip definately if i could but i only have unzip for droid and then there is tar in busybox but tar doesn't do what i need

推荐答案

(1):

当给定现有的zip压缩文件的名称,邮编将会取代同名作品在压缩存档或添加条目的新名称。

When given the name of an existing zip archive, zip will replace identically named entries in the zip archive or add entries for new names.

所以,只要用拉链命令,你通常会创建一个只包含一个文件,一个新的.zip文件,除了.ZIP文件名,可以指定将在现有归档。

So just use the zip command as you normally would to create a new .zip file containing only that one file, except the .zip filename you specify will be the existing archive.

这篇关于如何更新一个zip压缩文件一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆