Link to home
Start Free TrialLog in
Avatar of JeffBeall
JeffBeallFlag for United States of America

asked on

HPUX

i need to copy an entire directory to a nfs share - then I would like to copy only the changed filed to the nfs share. to copy only the changed files - so far i have this

find / -type f -xdev -mtime -1 -print | xargs ll | sort -rn -k5

I was wondering if it would work to pipe this find's output into a file - then somehow use the file to use the rcp command to copy only the changed files to my nfs share, would this be possible?
Avatar of yuzh
yuzh

FYI, you don't need to use "| xargs ll | sort -rn -k5"

you can direct the output of the find command to a file for later use.

eg:
find / -type f -xdev -mtime -1 -print >/tmp/myfilelist

and create a tar ball for the files in the list
tar -cvf /tmp/mtfile.tar `cat /tmp/myfilelist`

to make backup and restore easier, you should use related path to create the list.
eg
cd /
find . -type f -xdev -mtime -1 -print >/tmp/myfilelist

you can also use find + cp to copy files in one go, pleae look at the example
in http:Q_22575711.html

for more details.
Have a nice weekend!
There's a better way. Use rync to copy the changed files. As an example if /mnt/target is the nfs mount point and /home/files is the directory to be mirrored to the nfs mount point, the following command will sync the two directories:

rsync -av --delete /home/files/ /mnt/nfs

See "man rsync" for more information.
Avatar of JeffBeall

ASKER

I don't have rsyn. It is not in HPUX which is what my server runs.
ASKER CERTIFIED SOLUTION
Avatar of jlevie
jlevie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you