tar -zcvf backup.tar.gz public_html/ --exclude "public_html/phpMyAdmin" --exclude "public_html/logs"
I am outside the public_html directory while doing this.For a more general case, it would be:
tar -zcvf filename.tar.gz directory_to_backup --exclude "directory_to_exclude"
This way, I save time and space.Hope this will be useful.
Remember that individual files can be too excluded by replacing directory with filename.