(1)zip options
-f :update file or add file
-m :add file to zip achive then delete the original file
-u :same as -f
(1)add file
zip -m xxx.war filepath
zip -f xxx.war filepath
~$unzip -l test.war
Archive: test.war
Length Date Time Name
--------- ---------- ----- ----
0 2017-05-18 11:20 test/
1 2017-05-18 11:20 test/abc.txt
1 2017-08-29 13:37 web.xml
--------- -------
2 3 files
~$
~$zip -m test.war user/index.jsp
~$
~$unzip -l test.war
Archive: test.war
Length Date Time Name
--------- ---------- ----- ----
0 2017-05-18 11:20 test/
1 2017-05-18 11:20 test/abc.txt
0 2017-08-29 12:00 user/
1 2017-08-29 12:00 user/index.jsp
1 2017-08-29 13:37 web.xml
--------- -------
3 5 files
(2)update file
zip -f xxx.war filepath
~$unzip -l test.war
Archive: test.war
Length Date Time Name
--------- ---------- ----- ----
0 2017-05-18 11:20 test/
1 2017-05-18 11:20 test/abc.txt
0 2017-08-29 12:00 user/
1 2017-08-29 12:00 user/index.jsp
1 2017-08-29 13:37 web.xml
--------- -------
3 5 files
~$cat user/index.jsp
111
~$
~$echo "testabc">>user/index.jsp
~$
~$zip -f test.war web.xml
freshening: web.xml (deflated 24%)
~#
~$zip -f test.war user/index.jsp
freshening: user/index.jsp (deflated 24%)