tldr/pages/common/zip.md

36 lines
1017 B
Markdown
Raw Normal View History

2014-01-28 07:47:32 +00:00
# zip
> Package and compress (archive) files into zip file.
2014-01-28 07:47:32 +00:00
- Package and compress a directory and its contents, [r]ecursively:
`zip -r {{compressed.zip}} {{/path/to/dir}}`
- E[x]clude unwanted files from being added to the compressed archive:
`zip -r {{compressed.zip}} {{path/to/dir}} -x {{path/to/exclude}}`
- Archive a directory and its contents with the highest level [9] of compression:
`zip -r -{{9}} {{compressed.zip}} {{/path/to/dir}}`
- Package and compress multiple directories and files:
2014-01-28 07:47:32 +00:00
`zip -r {{compressed.zip}} {{/path/to/dir1 /path/to/dir2 /path/to/file}}`
2015-12-28 16:51:04 +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
`zip -e -r {{compressed.zip}} {{path/to/dir}}`
- Add files to an existing zip file:
2015-12-28 16:51:04 +00:00
`zip {{compressed.zip}} {{path/to/file}}`
- Delete files from an existing zip file:
2015-12-28 16:51:04 +00:00
`zip -d {{compressed.zip}} "{{foo/*.tmp}}"`
- Archive a directory and its contents to a multi-part [s]plit zip file (e.g. 3GB parts):
`zip -r -s {{3g}} {{compressed.zip}} {{path/to/dir}}`