tldr/pages/common/zip.md

34 lines
1.3 KiB
Markdown
Raw Normal View History

2014-01-28 07:47:32 +00:00
# zip
> Package and compress (archive) files into `zip` archive.
2022-07-06 21:47:47 +01:00
> See also: `unzip`.
> More information: <https://manned.org/zip>.
2014-01-28 07:47:32 +00:00
- Add files/directories to a specific archive ([r]ecursively):
2022-07-06 21:47:47 +01:00
`zip -r {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
- Remove files/directories from a specific archive ([d]elete):
2022-07-06 21:47:47 +01:00
`zip -d {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
2022-07-06 21:47:47 +01:00
- Archive files/directories e[x]cluding specified ones:
`zip -r {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}} -x {{path/to/excluded_files_or_directories}}`
2022-07-06 21:47:47 +01:00
- Archive files/directories with a specific compression level (`0` - the lowest, `9` - the highest):
2017-10-20 12:22:59 +01:00
2022-07-06 21:47:47 +01:00
`zip -r -{{0-9}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
2017-10-20 12:22:59 +01:00
2022-07-06 21:47:47 +01:00
- Create an [e]ncrypted archive with a specific password:
2015-12-28 16:51:04 +00:00
2022-07-06 21:47:47 +01:00
`zip -r -e {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
2015-12-28 16:51:04 +00:00
- Archive files/directories to a multi-part [s]plit `zip` archive (e.g. 3 GB parts):
2015-12-28 16:51:04 +00:00
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 ...}}`
2022-07-06 21:47:47 +01:00
- Print a specific archive contents:
2022-07-06 21:47:47 +01:00
`zip -sf {{path/to/compressed.zip}}`