A linux function to make current java code directory into a tarball without including unwanted files

Put the following function into your ~/.bashrc, and run “tarcode” in your code directory. It will generate a *.tgz file under ~/temp

        filename=`basename "$PWD"`
        filename+=`date '+%Y-%m-%dT%H%M%S'`

        echo $filename

	tar --exclude='.git' --exclude='.DS_Store' --exclude='.classpath' --exclude='.gitignore' --exclude='.project' --exclude='.settings' --exclude='target'  -zcvf $filename .

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.