Excluding folders when creating a tarball

When creating a tarball, to exclude folders one simply uses the –exclude= flag:

For example to tar up the contents of /var/log but to exclude /var/log/apache & /var/log/mail/

tar -jcvf logfiles.tar.bz2 /var/log/* --exclude=/var/log/apache/* --exclude=/var/log/mail/*

Just in case you didn't already know then the 'j' flag in the 'jcvf' tells tar to use bzip2 compression.