[TriLUG] copying files
Joseph Mack NA3T
jmack at wm7d.net
Tue Jun 19 20:00:14 EDT 2012
I want to copy all the new files in a directory to a back up
directory on a remote machine (nfs mounted)
local machine has
/local_dir/directory_to_be_backed_up/
cd /local_dir
cp -auv directory_to_be_backed_up $remote_dir
this works fine except that the directory to be backed up
has 10,000 files in it, at arbitary and varied depths, and
the link to the remote machine is slow. The copy has to
compare the dates of 10,000 files over a slow link for just
one copy. It turns out that the comparison takes all the
time.
However the files are updated exactly every 5 mins so I can
quickly find the new files locally
cd /local_dir
find ./ -mmin -5 -type f | xargs
Now I only need to copy my short list of new files, one of
which might be
file="./foo/bar/baz"
(where the depth varies for each file)
but now if I do
cp -auv $file $remote_dir
I get $remote_dir/baz
but I want
$remote_dir/foo/bar/baz
Anyone know how to copy a file and the directory structure
it's sitting in?
Thanks Joe
--
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!
More information about the TriLUG
mailing list