[TriLUG] copying files

Robert Dale robdale at gmail.com
Tue Jun 19 20:11:24 EDT 2012


rsync -a?

On Tue, Jun 19, 2012 at 8:00 PM, Joseph Mack NA3T <jmack at wm7d.net> 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
> --
> 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!
> --
> This message was sent to: Robert Dale <robdale at gmail.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web  :
> http://www.trilug.org/mailman/options/trilug/robdale%40gmail.com
> TriLUG FAQ          : http://www.trilug.org/wiki/Frequently_Asked_Questions



-- 
Robert Dale



More information about the TriLUG mailing list