sh script to traul through /usr/lib/perl5 ...

Hey,

Im trying to create a script to create a dir-tree of pod converted to html. so far this is the script:

#!/bin/sh

cd /usr/lib/perl5
for d in ./* ; do
    # is it a dir?
    if [ -d $d ]; then
        # yes! get the basename
        cd $d ; dir=`basename $d`
        for f in ./* ; do
            # is it a dir?
            if [ -d $f ]; then
                # yes! get the basename and create it
                ndir=`basename $f` ; mkdir -p /root2/perl-html/$dir/$ndir ; cd $f
                # is there anything in it
                for f2 in ./* ; do
                    #yes! what is it
                    if [ -d $f2 ]; then
                        # its a dir! get the basename and create it
                        ndir=`basename $f2` ; mkdir -p /root2/perl-html/$dir/$ndir ; cd $f2
                        # is there anything in it
                        for f3 in ./*.pm ; do
                            nfile=`basename $f3`; pod2html $nfile >/root2/perl-html/$dir/$ndir/$nfile.html
                        done
                    else
                        nfile=`basename $f2` ; pod2html $nfile >/root2/perl-html/$dir/$nfile.html
                    fi
                    cd ..
                done
            else
                nfile=`basename $f` ; pod2html $nfile >/root2/perl-html/$dir/$nfile.html
            fi
        done
    fi
    cd /usr/lib/perl5
done

# nfile=`basename $f2` ; pod2html $nfile >/root2/perl-html/$dir/$ndir/$nfile.html

It kinda works but the dirs don't get created and some dirs are comming out as .html files... I know iv'e overlooked something so simple but i cant see it ... In need of some jolt me thinks :confused:

Cheers,

Elfyn
elfyn@exposure.org.uk

Maybe this is not what you are trying to accomplish, but wouldn't this work?

#!/bin/sh
cd /usr/lib/perl5
find . -type d -exec mkdir /root2/perl-html/{} \; # Create the directory structure
find . -type f -exec -exec pod2html --outfile=/root2/perl-html/{}.html {} \;