Recursive file processing

I'm developing a generic script to catenate all files found in a given directory.
The problem I've got is that the depth of the given directory is unknown, so I end up with some catenated directories. My unix isn't that hot and I'm at a loss.
Heres an extract from the script

cd $1
for i in `find * -type d`
do
cd $i
for files in `find * -type f`
do
cat ${files} >> ${i}.ddl
done
done
~

:confused:

This is untested, but is probably very close.

cd $1
for i in `find . -type d`
do
      ( cd $i ; for files in `find . ! -name . -prune -type f` ; do
              cat ${files} >> ${i}.ddl
        done  )
done

Thanks Perderabo.
This didn't solve the problem but did provide alternate solutions.

How did you solve this finally? Can you provide the code?

ajitkt,

This is a thread of 2 years old, I don't think the OP will notice your question.
If you have any question, start a new thread, explain what you have so far, and what you're having trouble with.

Regards