HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Tar Restore Newer Files Only

 
SOLVED
Go to solution
Bob Ferro
Regular Advisor

Tar Restore Newer Files Only

I need to tar up some directories on server A and tar restore them to server B. But when I restore, I only want to restore any file that has a newer date from SERVER A. This way I don't overlay any file that was updated on server B. I can't exclude the files from the tar backup because I don't know if it's newer or older than the files on server B. These are directories with tons of files, too difficult to do it manually. Can I use tar or something else?
4 REPLIES
Steven E. Protter
Exalted Contributor
Solution

Re: Tar Restore Newer Files Only

Shalom,

I think I'd use rsync -e ssh

Looking at the man page for rsync it is capable of what you require.

Example run from host a to host b:

rsync -avH --stats --delete -e ssh /var/httpd/ user@hostb/web/

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor

Re: Tar Restore Newer Files Only

HI Bob:

You can use 'pax' to handle your 'tar' archives. With 'pax' "...If both the -u and -n flags are specified, the pax command does not consider a file selected unless it is newer than the file to which it is compared."

http://docs.hp.com/en/B2355-60130/pax.1.html

Regards!

...JRF...
Bob Ferro
Regular Advisor

Re: Tar Restore Newer Files Only

My finals results were that I used tar on the source server, then I used pax to restore on the destination server. Everything worked out fine and very easy to use. Thanks for all your help.
Bob Ferro
Regular Advisor

Re: Tar Restore Newer Files Only

When I want to know or learn anything about HP Unix, I come to this forum, you guys are the best. Nobody can touch you guys.