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
endorama 3597c70e6c
zip: add list files example and update first example (#5667)
From the `zip` man page: 
> The -sf show files option can be used to scan for files and get the list of files scanned without actually processing them.
2021-04-04 07:45:41 -04:00

35 lines
1 KiB
Markdown

# zip
> Package and compress (archive) files into zip file.
- Package and compress files and directories [r]ecursively:
`zip -r {{compressed.zip}} {{path/to/file}} {{path/to/directory1}} {{path/to/directory2}}`
- E[x]clude unwanted files from being added to the compressed archive:
`zip -r {{compressed.zip}} {{path/to/directory}} -x {{path/to/exclude}}`
- Archive a directory and its contents with the highest level [9] of compression:
`zip -r -{{9}} {{compressed.zip}} {{path/to/directory}}`
- Create an encrypted archive (user will be prompted for a password):
`zip -e -r {{compressed.zip}} {{path/to/directory}}`
- 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}}"`
- 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/directory}}`
- List files within a specified archive (without extracting them):
`zip -sf {{compressed.zip}}`