cpdir shell script & man page for 4.2 BSD

Rhode Roberts rlr at avsdT.UUCP
Thu May 16 07:35:22 AEST 1985


> > Yes, this is a trivial hack, but somebody had to do it.  Cut at the
> > dotted lines.  Works for us on VAX/4.2 BSD - others, beware.
> > 
> > -- Rex
> > ............................................................................
> > .TH CPDIR 1 LOCAL "USGS Pacific Marine Geology"
> > .SH NAME
> > cpdir - copy directory (and subdirectories)
>  ...
> 
> Pardon me, but doesn't the -r option to cp do the same thing?
> 
> ...truncated portion of cp man page:
> 
>      cp [ -i ] [ -r ] file1 file2
> 
>      cp [ -i ] [ -r ] file ... directory
> 
> DESCRIPTION
> 
>      If the -r option is specified and any of the source files
>      are directories, cp copies each subtree rooted at that name;
>      in this case the destination must be a directory.
> 
> --------------
> works good for me...
> 
> I tried direct e-mail, but the mailer bounced it back... must have been
> gatewayed from arpanet. oh-well...
> 
> Rick Chinn
> John Fluke Mfg. Co MS 232E
> PO Box C9090 Everett WA 98206
> 
> {ihnp4!uw-beaver, ucbvax!lbl-csam, microsoft, allegra, ssc-vax}!fluke!rzdz
> (206) 356-5232

*** REPLACE THIS LINE WITH YOUR MESSAGE ***

some people don't like to do things the easy way as in "cp -r".
so here is ( right out of the maual ) the tar version.
#
# Phony tree cp
#
#
if( $#argv != 2 ) then
	echo Incorrect Usage
	echo treecp path/dir_name dir_name
	echo \(path/dir is the directory to be copied\)
	echo \(dir_name is the name for the new directory\)
	exit ( 0 )
endif

set noglob
set target_path=`pwd`
set target=`echo $target_path/${2}`

mkdir $target
cd ${1} ; tar cf - . | ( cd $target ; tar xf - . )



More information about the Comp.sources.unix mailing list