unix copy

I have a HP-UX box and I copy each night to a mounted NFS share on a linux Ubuntu box. i currently use just a simple copy command

cp -r /source /destination

i would like to be a bit more fancy, and just copy files that changed during the week, and maybe the whole thing each weekend. is there a way to copy just the files that have changed since the last time i ran

cp -r /source /destination

?
LVL 1
JeffBeallAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
Hi,

have a look at rsync:

http://rsync.samba.org/

wmp
0
 
FastSiCommented:
Rsync may do just what you need http://samba.anu.edu.au/rsync/features.html
0
 
Martin_J_ParkerConnect With a Mentor Commented:
After you do the copy, update a file, then use the date/time of that file to search for newer files next time!

For example:

First time you do the copy:
cp -r /source /destination
touch updatefile

Now updatefile has a date/time stamp just after the copy.
The next time you can use find to locate and copy all files which have been updated since that touch

find /source -newer updatefile -exec cp {} /destination \;
touch updatefile

Each subsequent day you just keep doing the find and touch.
On weekends you do the full copy and touch.
Simples!
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Kerem ERSOYConnect With a Mentor PresidentCommented:
The first time you've used rsync it will copy all files. In the second time it will change only the files that are changed.


rsynv -av /source /destination

should do.

Cheers,
K.
0
 
JeffBeallAuthor Commented:
does rsync work with HP-UX? or is it a linux thing?
0
 
FastSiCommented:
I believe so but you will need to get the source and compile it using make I believe, have never used HP-UX
0
 
FastSiConnect With a Mentor Commented:
0
 
JeffBeallAuthor Commented:
thank you, i think this will work. i'll just put rsync on my Ubuntu box. that will be much safer. then i could share the directories i need on the HP-UX box then use rsync to copy the file from HP to linux. If this doesn't work, i could try Martin J Parker's suggestion.
Thanks for the help.
0
 
Kerem ERSOYPresidentCommented:
You must already have rsync by default in your ubuntu box.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.