If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > backup to tape based on date-time

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-16-07, 10:35
alfrednone alfrednone is offline
Registered User
 
Join Date: Feb 2005
Posts: 46
Question backup to tape based on date-time

hello all ,

could anyone help me with the following backup :

i need to do a backup on tape based on date-time .

i have 2 directories that i need to backup them to a tape but i need to do that for the directories that have the latest date .

how to do that ?

i want to put it in a script .
Best Regards

Last edited by alfrednone; 05-17-07 at 02:20.
Reply With Quote
  #2 (permalink)  
Old 05-18-07, 10:37
Tyveleyn Tyveleyn is offline
Registered User
 
Join Date: Aug 2006
Location: The Netherlands
Posts: 248
Hi,

It's not so clear to me which directories you want to test for age but you could do something with the find command and it's output piped to the tar command. Something like this:
Code:
#!/bin/bash                                                         
                                                                    
if [ `find . -type d -newer dir2 -name dir1 | wc -l` -ne 0 ]; then  
    find dir1 -print | tar -cf /dev/tape                                               
elif [ `find . -type d -newer dir1 -name dir2 | wc -l` -ne 0 ]; then
    find dir2 -print | tar -cf /dev/tape                                              
fi
Regards
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On