How to rename a file in a zip archive using Ant?

Everything is in the title. To be complete, I just want to rename the file without changing it.

Mana

+4
source share
1 answer

I do not believe that there is an Ant task for managing zip file entries in place. Even the Java API does not support incremental changes to zip files, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4129445 .

However, you can simply unzip it all, rename the desired file, and then zip it back:

<mkdir dir="tmp" /> <unzip src="src.zip" dest="tmp" /> <move file="tmp/src.txt" tofile="tmp/dest.txt" /> <zip destfile="dest.zip" basedir="tmp" /> 
+6
source

Source: https://habr.com/ru/post/1343734/


All Articles