#!/bin/sh dir=`dirname "$1"` file=`basename "$1"` cd $dir tar -cvzf $1.tar.gz "$file" cd $OLDPWD