Solved

unix copy

Posted on 2011-02-25
9
460 Views
Last Modified: 2012-05-11
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

?
0
Comment
Question by:JeffBeall
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 125 total points
ID: 34980850
Hi,

have a look at rsync:

http://rsync.samba.org/

wmp
0
 
LVL 4

Expert Comment

by:FastSi
ID: 34980886
Rsync may do just what you need http://samba.anu.edu.au/rsync/features.html
0
 
LVL 10

Assisted Solution

by:Martin_J_Parker
Martin_J_Parker earned 125 total points
ID: 34980933
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 125 total points
ID: 34980956
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
 
LVL 1

Author Comment

by:JeffBeall
ID: 34982143
does rsync work with HP-UX? or is it a linux thing?
0
 
LVL 4

Expert Comment

by:FastSi
ID: 34982242
I believe so but you will need to get the source and compile it using make I believe, have never used HP-UX
0
 
LVL 4

Assisted Solution

by:FastSi
FastSi earned 125 total points
ID: 34982247
0
 
LVL 1

Author Closing Comment

by:JeffBeall
ID: 34982306
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
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 34993656
You must already have rsync by default in your ubuntu box.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Internal CA server 6 88
LINUX Field Separators 7 55
Can't connect to FTP 17 92
Why would ubuntu server 16.04 compress so many small access.log.gz files? 4 33
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question