> I am using File::Find and File::Copy to accomplish the following:
> check a directory tree for all files that end in *.html and copy them to a

> different directory, preserving the tree structure.
> The following code works fine provided that all subdirectories already 
> exist. But is there a way to add the requirement "if the subdirectory does

> not yet exist, create it?"

In general,

        if (! -d $dir) {
            mkdir $dir
        }

though this doesn't address recursive mkdirs, e.g., making
/a/b/c/d if only /a exists.  I believe there's a CPAN module for that, too.

FYI, if you're on UNIX, the fastest way to solve this problem in isolation
is to skip Perl entirely and do something like

        cd olddir
        find . -name '*.htm' -print | cpio -o | (cd newdir && cpio -id)

Regards,
Jonathan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to