zipの-uフラグは削除されたファイルに焦点を当てますか?

zipの-uフラグは削除されたファイルに焦点を当てますか?

このウェブサイトLinux zip ユーティリティがこの-uフラグを説明する方法は次のとおりです。

zipアーカイブの既存のエントリは、修正時間がzipアーカイブにすでに存在するバージョンよりも最新の場合にのみ置き換え(更新)されます。たとえば、

        zip -u stuff * 

will add any new files in the current directory, and update any files which 

zipアーカイブstuff.zipが最後に作成/修正されてから修正されました。

私の質問は、最後のzip以降に特定のファイルが削除された場合、-uそのファイルが削除され、* .zipファイルから削除されたと認識されますか?です。または、タイムスタンプ情報が欠落している(ファイルが削除されたため)、「最新の」ファイルがないため、バックアップファイルは* .zipに保存されますか?

ベストアンサー1

zipバージョン3.0には次のものがあります。

   The new File Sync option (-FS) is also considered a new mode, though it
   is similar to update.  This mode  synchronizes  the  archive  with  the
   files  on  the OS, only replacing files in the archive if the file time
   or size of the OS file is different, adding  new  files,  and  deleting
   entries from the archive where there is no matching file.  As this mode
   can delete entries from the archive, consider making a backup  copy  of
   the archive.

私の考えでは、これはあなたが追いかけているようです。

もしあなたならするファイルをアーカイブにアーカイブするには-u:

$ mkdir test && touch test/{flibble,foobaz,blurp}
$ zip -r test test
  adding: test/ (stored 0%)
  adding: test/foobaz (stored 0%)
  adding: test/flibble (stored 0%)
  adding: test/blurp (stored 0%)
$ rm test/flibble && touch test/{,flibble}
$ zip -ru test test
updating: test/ (stored 0%)
updating: test/flibble (stored 0%)
$ unzip -l test
Archive:  test.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2013-08-15 22:04   test/
        0  2013-08-15 22:04   test/foobaz
        0  2013-08-15 22:04   test/flibble
        0  2013-08-15 22:04   test/blurp
---------                     -------
        0                     4 files

おすすめ記事