Excluding directories from ZIP and TAR archive

I’ve been using command line for zipping and ‘tarring’ for a while and never really needed to exclude directories from the archive.

I had to do this today and I worked out that I had to use absolute paths to achieve this.
The following examples will exclude multiple directories from tar and zip archives respectively:

tar -cvf documents.tar.gz /home/user/Documents --exclude "/home/user/Documents/exclude1" --exclude "/home/user/Documents/exclude2"

zip -vr -9 documents.zip /home/user/Documents -x "/home/user/Documents/exclude1" -x "/home/user/Documents/exclude2"

Marko