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?
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.
So is it possible to just replace the one xml without unzipping and rezipping ?
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
Open the archive in 7-Zip. Locate the file to be edited. Right-click on the file to edit and select "Edit" (alternative shortcut = F4). Make your changes, save them and close the editor window - 7-Zip will only detect the file has changed when the editor has been closed.
I've found the Linux zip
file to be cumbersome for replacing a single file in a zip. The jar
utility from the Java Development Kit may be easier. Consider the common task of updating WEB/web.xml
in a JAR file (which is just a zip file):
jar -uf path/to/myapp.jar -C path/to/dir WEB-INF/web.xml
Here, path/to/dir
is the path to a directory containing the WEB-INF
directory (which in turn contains web.xml
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With