]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/gzball
.bashrc: Add python pip --user path after finalizing $PATH
[dotfiles.git] / bin / gzball
1 #!/bin/sh
2 # create tar.gz archives and remove original dirs
3 # usage: gzball [-q] DIR [DIR] ...
4
5 ECHO="echo"
6
7 # be totally quite with -q argument
8 if [ "$1" == "-q" ] ; then
9 TAR="tar czf"
10 shift
11 else
12 TAR="tar cvzf"
13 fi
14
15 # bail on first error
16 set -e
17
18 for p in "$@" ; do
19 $ECHO "$p.tar.gz" # what we're building
20 $TAR "$p.tar.gz" "$p" # create tar.gz archive
21 touch -r "$p" "$p.tar.gz" # update modified time to match original DIR
22 rm -rf "$p" # remove original dir
23 done