shail_linux wrote: >As per the requirement backup is required for the past 4 days. I have >created five folders- mon,tue,wed,thu,fri. Everyday i have to change >the destination directory in the script. I want to automate this too. >How can i go about it? > > > I'm not sure what all of your requirements are, but if you didn't have to worry about days, your script could always backup to a "current." But before it starts the backup, it would move directories according to a rotate scheme. That is, if "5" exists, delete it; if "4" exists, move it to "5"; if "3" exists, move it to "4"; if "2" exists, move it to "1"; if "1" exists, move it to "2"; if "current" exists, move it to "1".
Then, on any given day, "current" is the latest backup, "1" is one day old, "2" is two days old, etc. Some logging programs use a rotation scheme like this to keep log data for an extended time while keeping the log files from becoming unmanagebly large. The scripting would look something like this (This is untested, mind you, so don't try it on real data right away!): cd "the place where my backup directories are kept" if [ -d 5 ]; then rm -rf 5; fi if [ -d 4 ]; then mv 4 5; fi if [ -d 3 ]; then mv 3 4; fi if [ -d 2 ]; then mv 2 3; fi if [ -d 1 ]; then mv 1 2; fi if [ -d current ]; then mv current 1; fi "do the backup to current" [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/0XFolB/TM --------------------------------------------------------------------~-> To unsubscribe from this list, please email [EMAIL PROTECTED] & you will be removed. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/LINUX_Newbies/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
