#!/bin/bash
if [ -z "$1" ]
then
echo "No argument supplied"
exit
fi
FULLPATH=$(/usr/bin/readlink -f $1)
BASENAME1=$(/bin/basename $FULLPATH )
MYPATH=$(/usr/bin/dirname $FULLPATH)
backupdir="$MYPATH/backupdir"
mydate=$(date +"%m-%d-%y-%N")
if [ ! -d "$backupdir" ]; then
mkdir $backupdir
fi
cp $MYPATH/$BASENAME1 $backupdir/$BASENAME1-$mydate
echo " copied to $backupdir/$BASENAME1-$mydate"
No comments:
Post a Comment