Pack a directory into a ZIP archive
zip a folder in linux | create a zip file | download a website as zip | compress a directory to zip | zip | archive | backupCaution: This command changes the system. Understand what it does before you run it.
cd /var/www/vhosts/example.com && zip -rq /var/www/vhosts/example.com/private/httpdocs.zip httpdocsChanges into the parent folder and packs the directory recursively (-r) without listing files (-q). Thanks to the change of directory, the archive contains relative paths like httpdocs/index.php instead of the full server path.
Note: For backups on Linux, tar is usually better because it fully keeps permissions and owners. ZIP is the better choice for recipients on Windows or macOS.
Also searched as
- zip a folder in linux
- create a zip file
- download a website as zip
- compress a directory to zip