現在のディレクトリのファイルとフォルダを含むすべてをUbuntuの単一のZIPファイルに圧縮してパッケージ化したいと思います。
最も便利なコマンドは何ですか(インストールする必要があるツールの名前(存在する場合))は何ですか?
編集:フォルダまたは複数のファイルを除外する必要がある場合はどうすればよいですか?
ベストアンサー1
インストールzip
と使用
zip -r foo.zip .
-0
(なし)から(最高)のフラグを使用して-9
圧縮率を変更できます。
フラグを使用してファイルを除外できます-x
。マニュアルページから:
-x files
--exclude files
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.
Also possible:
zip -r foo foo [email protected]
which will include the contents of foo in foo.zip while excluding all the files that match the patterns in the file exclude.lst.
The long option forms of the above are
zip -r foo foo --exclude \*.o
and
zip -r foo foo --exclude @exclude.lst
Multiple patterns can be specified, as in:
zip -r foo foo -x \*.o \*.c
If there is no space between -x and the pattern, just one value is assumed (no list):
zip -r foo foo -x\*.o
See -i for more on include and exclude.