Re: [PATCH] adding two new options to 'cp'



On Thursday 27 July 2006 13:44, Doug Barton wrote:
Oliver Fromme wrote:
Eric Anderson <anderson@xxxxxxxxxxxx> wrote:
> I'm tired of trying to use rsync or gcp (which doesn't like symlinks
> often) to copy trees of files/directories using hard links, so I added
> the gcp-ish options -a and -l.
>
> -a is 'archive' mode, which is just a quick form of -PpR.

-P is the default anyway, so -a would only replace -Rp.
I don't think saving one letter justifies introducing a new
option. You can use an alias or shell function.

> -l is 'link' mode, where regular files get hard linked instead of
copied.
>
> So, you can mimic an entire tree with something like:
>
> cp -al /from/ /to/
>
> and it's fast too!

You can do the same with existing tools in a portable
(and thus preferable) way:

cd /from; find -d . | cpio -dumpl /to

While I don't want to stifle anyone's creativity, I agree with Oliver (and
other posters) on this one. The Unix way of doing things is small programs
that do their jobs well, tied together to accomplish bigger things.

OTOH, 'cp -al' is a lot less to type. :) It also is not NIH as it is
simulating the interface of another system. Maybe I'm just stodgy b/c I
never use cpio(8) (it seems to be one of the more cryptic programs).

--
John Baldwin
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Kernel SCM saga..
    ... We'd need a regenerated coherent copy of BKCVS to pipe into those SCM to ... It looks similar to a diff -ur of two hardlinked trees, ... worthless after using rsync in the network, ...
    (Linux-Kernel)
  • Re: Re: [rfc] git: combo-blobs
    ... >> the time the easiest thing to do is to just rsync with another copy. ... if you won't support updating tracked trees (does not sound ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: [rfc] git: combo-blobs
    ... > the time the easiest thing to do is to just rsync with another copy. ... between two trees in those cases? ... send the line "unsubscribe linux-kernel" in ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Common part of two trees
    ... I try to find a common part of two trees (only directories, ... symlinks and include them as subdirectories. ... this is not the best solution as it may loop (I mean symlinks may loop ... How to build a complete list of the tree (with included subdirectories ...
    (comp.unix.shell)