#!/bin/sh date=`date +%Y%m%d%k%M%S` path=$1 # Path to use is given on the command line # Use last directory in ${path} as the filename to save # to. (Could use awk or something else here, but I'm # more familer with Perl). # save_file=`perl -e '$file=pop; $file=~m!/(.*)$!; print $1' ${path}` tar -zxf ${save_file}-${date}.tar.gz ${path}