1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/zip.md
Eric Nielsen 43ff4dd736 zip: simplify -x example
According to the 5th item of the
[Guidelines](https://github.com/tldr-pages/tldr/blob/master/CONTRIBUTING.md#guidelines),
avoid getting into details like glob patterns.
2017-10-05 16:19:48 -05:00

752 B

zip

Package and compress (archive) files into zip file.

  • 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:

zip -r {{compressed.zip}} {{/path/to/dir1 /path/to/dir2 /path/to/file}}

  • Add files to an existing zip file:

zip {{compressed.zip}} {{path/to/file}}

  • Delete files from an existing zip file:

zip -d {{compressed.zip}} "{{foo/*.tmp}}"