bash rookie needs help w/ variable
Hi all...
I've been trying to find a way to do this, I know there is and I know it's probably simple but I cant wrap my brain around it.
I'm backing up a series of directories on a daily basis, creating one tar.gz file for each folder. This works fine. It currently saves the file name as todays date, but I'd like to add the name of each directory to the title of each tar.gz file, along with the date. So if a directory I'm archiving is named 'lobby' and it's November 30 2007, I want it named lobby113007.tar.gz
Here is my big whopping script...
filename=`date +%m%d%y`
variable to today's date.
for dir in /home/camera/*
do
tar -czvf /home/archives/$filename.tar.gz $dir
done
What kind of variable would I need to have it gather the directory name, then add it to the file?
Thanks!