Put the following function into your ~/.bashrc, and run “tarcode” in your code directory. It will generate a *.tgz file under ~/temp
tarcode() { filename=`basename "$PWD"` filename+='-' filename+=`date '+%Y-%m-%dT%H%M%S'` filename=$HOME'/temp/'$filename'.tgz' echo $filename tar --exclude='.git' --exclude='.DS_Store' --exclude='.classpath' --exclude='.gitignore' --exclude='.project' --exclude='.settings' --exclude='target' -zcvf $filename . }