Hi ,
I am new to shell scripting.Please help me with this.
Write a shell script that copies all files in a current directory into a "Backup" or "Archive" directory, then combines all files in that directory into on "tar" file via the "tar" program, and finally compresses the tarred file via 'gzip' . And we have to delete the backup files older that 1 month.
edit by scottn: Homework violation. Thread closed.
your requirements are not clear and as it is said before it sounds like a homework. However as i write a similar script to compress CDR files before i can help you, i havent tested it, not sure if its %100 sure. Besides you can run this daily:
DATE=`date +%Y%m%d`
PATH=`/path/to/current/directory`
if [ ! -e $PATH/Backup$DATE ]; then
mkdir $PATH/Backup$DATE
fi
find $PATH -type f -name "*.cdr" -mtime -1 -exec cp * $PATH/Backup$DATE {} \;
tar -cvf Backup$DATE.tar $PATH/Backup$DATE
gzip Backup$DATE.tar