David Brett wrote:

> Is there an easy way to do the following copy.  I am not sure even how to
> do it in a script.
>
> directory 1 has files like
>
> rootfilename-1.html
> rootfilename-2.html
> rootfilename.log
>
> directory 2 has files like
> newrootfilename-1.html
> newrootfilename-2.html
> newrootfilename.log
>
> what I want to do is copy the contents of the files in directory 1 to the
> corresponding filename in directory 2.
>
> The reason I say I can't think of an easy script is I have a number of
> directory with varing number files.

#!/bin/sh
for oldfile in `ls $1`; do
    cp $1/$oldfile $2/new$oldfile
done

Should come close,
call it like
mycopy origdir newdir

You will have to have the directories already there. Not sure what ls -R
would do.  Should probably test to see if the file is a file create needed
dirs for a recursive deal.

Bret



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to