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

Who is Participating?
woolmilkporcConnect With a Mentor Commented:

have a look at rsync:


Rsync may do just what you need http://samba.anu.edu.au/rsync/features.html
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.
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.

JeffBeallAuthor Commented:
does rsync work with HP-UX? or is it a linux thing?
I believe so but you will need to get the source and compile it using make I believe, have never used HP-UX
FastSiConnect With a Mentor Commented:
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.
Kerem ERSOYPresidentCommented:
You must already have rsync by default in your ubuntu box.
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.