Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't manage to figure out the -x option in the command zip. I want to compress a working folder to save it as a backup, but I have some files and a directory that contains huge files that I don't need to save. Therefore I would like to compress the whole directory except for the one listed above.

Here is my script:

echo "Saving all work directory in the backup"

now=$(date +'%Y_%m_%d')
filename=($(echo "backup_"$now))
cd /local00/home/F48174/Documents/scripts_eprou_aster/
echo "... removing /base because it's huge ..."

zip -9 -r /local00/home/F48174/Documents/backup/$filename.zip  -x /local00/home/F48174/Documents/scripts_eprou_aster/base/

Sorry for the really poor code quality, I'm only beginning to learn shell scripting.

share|improve this question
You need to tell zip what has to be zipped: zip -r archive.zip folder_to_zip -x file_not_to_zip – Jasper May 12 '14 at 8:30

Modify the last line to be,

zip -9 -r /local00/home/F48174/Documents/backup/$filename.zip  -x /local00/home/F48174/Documents/scripts_eprou_aster/base\*
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.