[PATCH] adding two new options to 'cp' (UPDATE)

Eric Anderson anderson at centtech.com
Tue Aug 1 12:44:04 UTC 2006


On 07/26/06 21:51, 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/
> 
> 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

I've made an updated patch available.  It fixes the missing information 
in the usage output, a file descriptor leak, and also now warns when an 
attempt to copy a socket occurs instead of erroring.  This isn't really 
particular to any of the new arguments, but is more consistent with 
other tools, and consistent with cp's other options that just warn.

The new patch can be found here:
http://www.googlebit.com/freebsd/patches/cp-patch-2

Eric



-- 
------------------------------------------------------------------------
Eric Anderson        Sr. Systems Administrator        Centaur Technology
Anything that works is better than anything that doesn't.
------------------------------------------------------------------------


More information about the freebsd-hackers mailing list