[PATCH] adding two new options to 'cp'

Julian Elischer julian at elischer.org
Thu Jul 27 03:51:14 UTC 2006

Eric Anderson 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.
> -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/

I've always used:
find . -depth |cpio -pdlmv $dest
(fully portable)  but your addition can't hurt (well it might make the 
larger program load a bit slower
but it isn't that much.)

> and it's fast too!
> Patch is against 6-STABLE, but works well on 7-CURRENT as well.
> Patch is here (with man page edits):
> http://www.googlebit.com/freebsd/patches/cp-patch
> cd /tmp/
> fetch http://www.googlebit.com/freebsd/patches/cp-patch
> cd /usr/src/
> patch < /tmp/cp-patch
> cd bin/cp
> make && make install
> Patch was done for rsnapshot users mainly (there are quite a few of us).
> Comments? Flames? Committers willing to commit?
> Eric

More information about the freebsd-hackers mailing list