zip
スポンサーリンク
何するコマンド?
書き方
zip [オプション1] [zipファイル名] [ファイル名(複数可能)] [オプション2]
オプション
| オプション | 説明 |
|---|---|
| -a | アスキーモードにするよ |
| -A | Adjust self-extracting executable archive. A self-extracting executable archive is created by prepending the SFX stub to an existing archive. The -A option tells zip to adjust the entry offsets stored in the archive to take into account this "preamble" data. |
| -B | [VM/CMS and MVS] force file to be read binary (default is text). |
| -B【数字】 | [TANDEM] set Edit/Enscribe formatting options with n defined as bit 0: Don碪 add delimiter (Edit/Enscribe) bit 1: Use LF rather than CR/LF as delimiter (Edit/Enscribe) bit 2: Space fill record to maximum record length (Enscribe) bit 3: Trim trailing space (Enscribe) bit 8: Force 30K (Expand) large read for unstructured files |
| -b【パス】 | Use the specified path for the temporary zip archive. |
| -c | 元ファイルにコメントをつける |
| -d | ファイルをzipファイルの中から取り除く |
| -D | ファイルのみを圧縮する。ディレクトリは含めない。 |
| -e | パスワード付きzipファイルにする |
| -E | [OS/2] Use the .LONGNAME Extended Attribute (if found) as filename. |
| -f | 指定されたファイルがzipファイル内にすでに存在する場合、新しければ置き換える |
| -F | zipファイルを修復してみる |
| -g | 既存のzipファイルに追加する |
| -h | ヘルプを表示する |
| -i 【ファイル名】 | 指定ファイルのみを格納する |
| -j | ファイル名のみ追加する(パスやディレクトリ名は記録しない) |
| -J | Strip any prepended data (e.g. a SFX stub) from the archive. |
| -l | 改行コードをLFからCR+LFに変換する |
| -ll | 改行コードをCR+LFからLFに変換する |
| -L | zipコマンドのライセンスを表示する |
| -m | zipファイルに追加したとき、元ファイルは削除する |
| -n 【拡張子】 | 指定拡張子のファイルは圧縮しないで格納する |
| -o | zipファイルの更新日時を元ファイルの最新のファイル更新時刻に合わせる |
| -P 【パスワード】 | パスワード付きzipファイルにする |
| -q | 処理中のメッセージを表示しない |
| -r | 指定ディレクトリ配下のファイル、ディレクトリを再帰的に格納する |
| -R | カレントディレクトリ配下のファイル、ディレクトリを再帰的に格納する |
| -t 【日付mmddyyyy】 | 指定された日付以降のファイルを対象とする |
| -tt 【日付mmddyyyy】 | 指定された日付以前のファイルを対象とする |
| -T | 作ったzipファイルの整合性をチェックする? |
| -u | 新規作成 or 更新されたファイルのみ追加する |
| -v | 処理結果をじっくりはっきり詳細に出力する |
| -V | [VMS] Save VMS file attributes and use portable form. zip archives created with this option are truncated at EOF but still may not be usable on other systems depending on the file types being zipped. |
| -VV | [VMS] Save VMS file attributes and use portable form. zip archives created with this option are truncated at EOF but still may not be usable on other systems depending on the file types being zipped. |
| -w | [VMS] Append the version number of the files to the name, including multiple versions of files. (default: use only the most recent version of a specified file). |
| -x 【ファイル名】 | Explicitly exclude the specified files, as in: zip -r foo foo -x \*.o which will include the contents of foo in foo.zip while excluding all the files that end in .o. The backslash avoids the shell filename substitution, so that the name matching is performed by zip at all directory levels. If you do not escape wildcards in patterns it may seem to work but files in subdirectories will not be checked for matches. Also possible: zip -r foo foo -x@exclude.lst which will include the contents of foo in foo.zip while excluding all the files that match the patterns in the file exclude.lst (each file pattern on a separate line). |
| -X | Do not save extra file attributes (Extended Attributes on OS/2, uid/gid and file times on Unix). |
| -y | 対象がシンボリックリンクの場合、リンク先のファイルではなくシンボリックリンク自体を追加する |
| -z | Prompt for a multi-line comment for the entire zip archive. |
| -【数字】 | 圧縮速度を指定する。「-0」は圧縮しない。「-1」は圧縮率よりも処理速度優先。「-9」は処理速度よりも圧縮率を優先 |
| -@ | 圧縮対象のファイル名を対話形式で入力する |
補足事項
単純に圧縮したい場合は
zip [zipファイル名] [元ファイル名(複数可能)]
でOKです。
例えば
zip a.zip a.txt b.txt
のように打つと「a.txt」と「b.txt」をまとめて圧縮して「a.zip」を作ってくれます。
あとは必要に応じてオプションを指定すれば良いと思います。
