Tuesday, June 26, 2007

Recursively Zip Files and Directories

It's not uncommon for system administrators to zip files and directories, especially if they are frequently sending data over email. Personally, I prefer it over the UNIX compress command. By the way, the UNIX zip command is compatible with the PC pkzip command. Here's the syntax.

Files and directories added to myzipfile
# zip -r myzipfile esofthub softhub.tar archive_dir mypic.gif mydir restrict_dir
# ls -l myzipfile.zip

Don't try to compress these file extensions
# zip -rn .zip: .jpg: .png: .gif myzipfile esofthub softhub.tar archive_dir mypic.gif mydir restrict_dir

Files only
#zip zipfile myfile1 myfile2 myfile3 myfile4 ...
#ls -l zipfile.zip

No comments: