[plug] tar vs cp -r
Craig Ringer
craig at postnewspapers.com.au
Thu Mar 10 16:10:54 WST 2005
On Thu, 2005-03-10 at 14:51 +0800, Jim Householder wrote:
> Hi
>
> On a number of occasions I have seen a preference shown for using tar to
> move large trees rather than cp -r.
In addition to the points made by others, tar works well over ssh (so
long as you use no-pty, as I found out) and can be *dramatically* faster
than using `scp -r'.
It's also possible to pipe a list of files to be copied, generated by,
eg, `find', into tar (or at least star) or add restrictions like files
modified after a certain date. `cp -r' isn't really all that smart.
For just straight copies, cp -aR should do the job nicely. More complex
tasks can benefit from using an archiver (like tar, star, pax, etc) or
special tool like rsync or unison.
--
Craig Ringer
More information about the plug
mailing list