On Fri, Oct 19, 2007 at 01:52:03PM -0400, Douglas A. Tutty wrote:
| Conceptually, though, why can't cp look at the source directory and take a
| snapshot, a to-do-list, of everything it has to copy, then do it?  That
| way, any recursion would be completed before the target directory
| appeared in the source directory.  With only an -R (no -H -L or -P), it
| should copy links as links which should avoid loops.

What will you do if the underlying directory structure has tons and
tons of files and subdirectories ? First traverse this entire tree,
keeping it all in memory ? Sounds pretty expensive.

| How do scp and rsync do it?

Why not try it ? scp local to remote doesn't make sense in this case,
since src and dst are not really the same. scp local to local has the
exact same effect (you even get an error message from cp that the name
is too long).

rsync does exactly what you just propose. It scans the entire src
directory structure, keeping it all in memory, and then copies that to
dst. If there's too many files in your hierarchy, rsync will fail. cp
will not (unless of course you run out of inodes).

Cheers,

Paul 'WEiRD' de Weerd

-- 
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/                 

Reply via email to