2014-01-28 07:47:32 +00:00
|
|
|
# zip
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Package and compress (archive) files into zip file.
|
2021-09-01 20:08:03 +01:00
|
|
|
> More information: <https://manned.org/zip>.
|
2014-01-28 07:47:32 +00:00
|
|
|
|
2021-04-04 12:45:41 +01:00
|
|
|
- Package and compress files and directories [r]ecursively:
|
2016-09-01 16:41:00 +01:00
|
|
|
|
2021-04-04 12:45:41 +01:00
|
|
|
`zip -r {{compressed.zip}} {{path/to/file}} {{path/to/directory1}} {{path/to/directory2}}`
|
2016-09-01 16:41:00 +01:00
|
|
|
|
|
|
|
- E[x]clude unwanted files from being added to the compressed archive:
|
|
|
|
|
2020-10-28 17:19:43 +00:00
|
|
|
`zip -r {{compressed.zip}} {{path/to/directory}} -x {{path/to/exclude}}`
|
2016-09-01 16:41:00 +01:00
|
|
|
|
2017-03-01 10:12:25 +00:00
|
|
|
- Archive a directory and its contents with the highest level [9] of compression:
|
|
|
|
|
2020-10-28 17:19:43 +00:00
|
|
|
`zip -r -{{9}} {{compressed.zip}} {{path/to/directory}}`
|
2017-03-01 10:12:25 +00:00
|
|
|
|
2017-10-20 13:18:06 +01:00
|
|
|
- Create an encrypted archive (user will be prompted for a password):
|
2017-10-20 12:22:59 +01:00
|
|
|
|
2020-10-28 17:19:43 +00:00
|
|
|
`zip -e -r {{compressed.zip}} {{path/to/directory}}`
|
2017-10-20 12:22:59 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Add files to an existing zip file:
|
2015-12-28 16:51:04 +00:00
|
|
|
|
|
|
|
`zip {{compressed.zip}} {{path/to/file}}`
|
|
|
|
|
2016-09-01 21:39:16 +01:00
|
|
|
- Delete files from an existing zip file:
|
2015-12-28 16:51:04 +00:00
|
|
|
|
|
|
|
`zip -d {{compressed.zip}} "{{foo/*.tmp}}"`
|
2018-02-09 10:52:28 +00:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Archive a directory and its contents to a multi-part [s]plit zip file (e.g. 3 GB parts):
|
2018-02-09 10:52:28 +00:00
|
|
|
|
2020-10-28 17:19:43 +00:00
|
|
|
`zip -r -s {{3g}} {{compressed.zip}} {{path/to/directory}}`
|
2021-04-04 12:45:41 +01:00
|
|
|
|
|
|
|
- List files within a specified archive (without extracting them):
|
|
|
|
|
|
|
|
`zip -sf {{compressed.zip}}`
|