tar excluding some files
I am working on a backup script and have to use tar with --exclude option somewhere in the script.
I need create a single tar ball with contents of two directories test1 and test2. In directory test1, all .jpg files needs to be excluded, but all the contents of another directory test2 (including .jpg files) has to be taken while tarring.
A command like following excludes .jpg files in both test1 and test2 directories, but I need to exclude .jpg files only from /home/test2.
tar -hcvzf testing.tar.gz /home/test1 --exclude *.jpg /home/test2
It would be great if someone could give some ideas.