To obtain a fresh zip file just like as tar does, do I have to perform rm foo.zip before executing zip?

$ mkdir foo; touch foo/bar
$ zip -r foo.zip foo
  adding: foo/ (stored 0%)
  adding: foo/bar (stored 0%)
$ rm foo/bar; touch foo/baz
$ zip -r foo.zip foo
  adding: foo/ (stored 0%)
  adding: foo/baz (stored 0%)
$ unzip -l foo.zip
Archive:  foo.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2011-10-27 07:49   foo/
        0  2011-10-27 07:49   foo/bar
        0  2011-10-27 07:49   foo/baz
---------                     -------
        0                     3 files
link|improve this question
feedback

1 Answer

up vote 0 down vote accepted

Use the -FS option to "file sync"

zip -FSr foo.zip foo

This will add any new files in the folder to the zip, and delete any files from the zip that aren't in the folder.

link|improve this answer
Thank you for your answer! – asari Jan 16 at 7:07
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.