Skip to content

Instantly share code, notes, and snippets.

@jesusgoku
Last active August 29, 2015 14:26
Show Gist options
  • Save jesusgoku/1bbf41ace1e443618154 to your computer and use it in GitHub Desktop.
Save jesusgoku/1bbf41ace1e443618154 to your computer and use it in GitHub Desktop.
Compress files and exclude folders or files
# With ZIP. Include complete pattern to exclude
zip -9 -r -x"intranet/.git/*" \
-x"intranet/app/logs/*" \
-x"intranet/app/cache/*" \
-x"intranet/.idea/*" \
-x"intranet/files/*" \
-x"intranet/web/compiled/*" \
-x"intranet/vendor/*" \
-x"intranet/web/assets/*" \
intranet.zip \
intranet/
# With TAR. Include partial pattern to exclude
tar -cjvf intranet.tar.bz2 \
--exclude ".git/*" \
--exclude "vendor/*" \
--exclude "web/assets/*" \
--exclude "app/logs/*" \
--exclude "app/cache/*" \
--exclude "web/compiled/*" \
--exclude ".idea/*" \
--exclude "files/*" \
--exclude "web/uploads/*" \
intranet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment