2022-07-06 21:47:47 +01:00
|
|
|
# zip
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
> Package and compress (archive) files into a Zip archive.
|
2022-07-06 21:47:47 +01:00
|
|
|
> See also: `unzip`.
|
|
|
|
> More information: <https://manned.org/zip>.
|
|
|
|
|
|
|
|
- Add files/directories to a specific archive:
|
|
|
|
|
|
|
|
`zip -r {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
|
|
|
|
|
|
|
- Remove files/directories from a specific archive:
|
|
|
|
|
|
|
|
`zip --delete {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
|
|
|
|
|
|
|
- Archive files/directories e[x]cluding specified ones:
|
|
|
|
|
|
|
|
`zip {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}} --exclude {{path/to/excluded_files_or_directories}}`
|
|
|
|
|
|
|
|
- Archive files/directories with a specific compression level (`0` - the lowest, `9` - the highest):
|
|
|
|
|
2024-02-09 07:59:12 +00:00
|
|
|
`zip -r -{{0..9}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
2022-07-06 21:47:47 +01:00
|
|
|
|
|
|
|
- Create an encrypted archive with a specific password:
|
|
|
|
|
|
|
|
`zip -r --encrypt {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Archive files/directories to a multi-part [s]plit Zip archive (e.g. 3 GB parts):
|
2022-07-06 21:47:47 +01:00
|
|
|
|
|
|
|
`zip -r -s {{3g}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
|
|
|
|
|
|
|
- Print a specific archive contents:
|
|
|
|
|
|
|
|
`zip -sf {{path/to/compressed.zip}}`
|