Recursively Zip Up a Directory while Excluding Certain Files Based on File Extension Type

In the example below, I’m going to zip up a directory that includes images in both PNG and PSD file formats. However, I want to exclude the PSDs because they are huge!

zip -r my-compressed-dir-without-psd.zip directory-to-zip -x '*.psd'
  • http://seanbehan.com sean

    to exclude directories and or to exclude mutliple file types here is the command

    zip -r dir2zip.zip dir2zip -x ‘./dir2zip/.git/*’ ‘*.psd’ ‘*.svg’ ‘*.log’ ‘*.sqlite3′