2 problems, maybe related.

1) My recursive program is generating a "called to early to check
   prototype" error.  Ive Googled for answers but cannot find a solution

2) When this executes, it traverses 8 directories in F:\\Inetpub\\Develop
   then stops and traverses 8 directories in F:\\Inetpub\\Publish

   I cannot seem to figure out why it's giving up so early when there's
   more than 8 directories in each folder.


Thanks
 Birl

Please do not CC me responses to my own posts.
I'll read the responses on the list.





use strict;
use warnings;

my $indent=0;
my $ERRORS=0;

my $OUTPUT="D:\\Logs\\IIS\\unlock_Read-Only_files.log";

sub OpenDirectory($)
{
        $indent++;

        my $counter=0;
        my $Directory=shift;
        my $FILE;
        my $LongDirectoryName="";



        for ($counter=1; $counter < $indent; $counter++) { printf("  "); }

        if ( (defined $LongDirectoryName) && ($LongDirectoryName !~ /^$/) )
        {
                $LongDirectoryName=sprintf("%s\\%s", $LongDirectoryName, 
$Directory);
        }
        else
        {
                $LongDirectoryName=$Directory;
        }


        printf(Loghandle "Opening directory \"%s\":  ", $LongDirectoryName);

        if ( opendir(DIRhandle, "$LongDirectoryName") )
        {
                printf(Loghandle "success\n");

                while ( defined ($FILE = readdir(DIRhandle)) )
                {
                        for ($counter=0; $counter < $indent; $counter++) { 
printf(Loghandle "  "); }

                        if ($FILE =~ /\.\.?$/)
                        {
                                printf(Loghandle "skipping \"%s\"\n", $FILE);
                        }
                        else
                        {
                                if    (-f "$LongDirectoryName\\$FILE")
                                {
                                        #printf(Loghandle "\"%s\" is a 
file.\n", $FILE);
                                        if ( system("attrib -R 
$LongDirectoryName\\$FILE") )
                                        {
                                                for ($counter=0; $counter < 
$indent; $counter++) { printf(Loghandle "  "); }
                                                printf(Loghandle "FAILED: file 
attrib    $!\n");
                                        }

                                }
                                elsif (-d "$LongDirectoryName\\$FILE")
                                {
                                        #printf(Loghandle "\"%s\" is a 
directory.\n", $FILE);
                                        if ( system("attrib -R 
$LongDirectoryName\\$FILE") )
                                        {
                                                for ($counter=0; $counter < 
$indent; $counter++) { printf(Loghandle "  "); }
                                                printf(Loghandle "FAILED: 
folder attrib  $!\n");
                                        }

                                        
OpenDirectory("$LongDirectoryName\\$FILE");
                                }
                                else
                                {
                                        printf(Loghandle "\"%s\" is an 
unknown.\n", $FILE);
                                }
                        }

                        printf("Analyzed: \"%s\\%s\"\n", $LongDirectoryName, 
$FILE);

                }
        }
        else
        {
                printf(Loghandle "FAILED: $!\n");
        }

        closedir(DIRhandle);
        $indent--;
}



if (! open(Loghandle, ">$OUTPUT") )
{
        die "Could not open \"$OUTPUT\" for writing: $!";
}

OpenDirectory("F:\\Inetpub\\Develop");
OpenDirectory("F:\\Inetpub\\Publish");

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to