使用tar的 --exclude的选项
$ tar --exclude='./folder' --exclude='./upload/folder2' -zcvf /backup/filename.tgz .
-- exclude 选项一定要放在目标文件之前
来源: https://stackoverflow.com/questions/984204/shell-command-to-tar-directory-excluding-certain-files-folders