[TriLUG] copying files

David Both dboth at millennium-technology.com
Tue Jun 19 21:02:48 EDT 2012


How about rsync? That copies only the new files and modified portions of altered 
files. I use that for remote backups and it works very well. It can take a long 
time for the first sync though. After that only minutes to sync up thousands of 
files.


On 06/19/2012 08:00 PM, Joseph Mack NA3T wrote:
> 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

-- 

*********************************************************
"I'd put my money on the sun and solar energy. What a source of power! I hope we 
don't have to wait until oil and coal run out before we tackle that."
  - Thomas Edison, in conversation with Henry Ford and Harvey Firestone, 1931

*********************************************************
David P. Both




-- 


*********************************************************
David P. Both, RHCE
Millennium Technology Consulting LLC
919-389-8678

dboth at millennium-technology.com

www.millennium-technology.com
www.databook.bz - Home of the DataBook for Linux
DataBook is a Registered Trademark of David Both





More information about the TriLUG mailing list