[CLUE-Tech] The cp command

Brandon N bneill at yahoo.com
Sat Apr 14 22:11:06 MDT 2001


here is the script, i called it cpr  (copy recursively)

#!/bin/bash
for directory in `ls -d */`;
do
    cp $1 $directory
done



then just do 
cpr file


--- Kevin Cullis <kevincu at orci.com> wrote:
> Brandon N wrote:
> > 
> > > > Hi,
> > > >
> > > > I'd like to copy a file into all recursive directories below
> the
> > > current
> > > > directory, I've tried using:
> > > >
> > > > cp -R filename
> > > >
> > > > but it didn't work.  Any suggestions?
> > > >
> > > > Kevin
> > 
> > what do you mean recursivly ie:
> > 
> > case 1
> > /
> > | dir1/
> > | dir2/
> > | dir3/
> > 
> 
> This one!
> 
> > 
> > either way, you're going to have to use a FOR loop to copy in to
> all
> > three directories.
> > 
> 
> I was thinking that was the way I'd have to go, but I'm not at that
> point in scripting yet and wanted to see if there was another way.
> 
> The issue is  I have a JPEG which I wanted to cp into each directory
> since all of them needed it. I could also pipe the same file into
> each
> directory, right?
> 
> Kevin
> _______________________________________________
> CLUE-Tech mailing list
> CLUE-Tech at clue.denver.co.us
> http://clue.denver.co.us/mailman/listinfo/clue-tech


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



More information about the clue-tech mailing list