williamr/delete_builds.pl
changeset 282 a265a2da5fcb
parent 281 c62bd4f9dbce
child 291 66b0448c2de4
equal deleted inserted replaced
281:c62bd4f9dbce 282:a265a2da5fcb
    51     print "Ignoring $dir - not a directory\n";
    51     print "Ignoring $dir - not a directory\n";
    52     next;
    52     next;
    53     }
    53     }
    54   if (!-d "$dir/output")
    54   if (!-d "$dir/output")
    55     {
    55     {
    56     print "Ignoring $dir - not a build\n";
    56     # not a build - perhaps a directory of builds?
    57     next;
    57     opendir DIR, $dir;
       
    58     my @files = grep !/^\.\.?$/, readdir DIR;
       
    59     closedir DIR;
       
    60     
       
    61     my @subbuilds = ();
       
    62     foreach my $file (@files)
       
    63       {
       
    64       next if (!-d "$dir/$file");
       
    65       next if (!-d "$dir/$file/output");
       
    66       push @subbuilds, "$dir/$file";
       
    67       }
       
    68     if (scalar @subbuilds == 0)
       
    69       {
       
    70       print "Ignoring $dir - not a build and contains no builds\n";
       
    71       next;
       
    72       }
       
    73     push @builds, @subbuilds;
    58     }
    74     }
    59   push @builds, $dir;
    75   else
       
    76     {
       
    77     push @builds, $dir;
       
    78     }
    60   }
    79   }
    61 
    80 
    62 foreach my $subdir (@rich_pickings)
    81 foreach my $subdir (@rich_pickings)
    63   {
    82   {
    64   foreach my $build (@builds)
    83   foreach my $build (@builds)
    72   }
    91   }
    73 
    92 
    74 foreach my $build (@builds)
    93 foreach my $build (@builds)
    75   {
    94   {
    76   $build =~ s/\//\\/g;
    95   $build =~ s/\//\\/g;
    77   print "* rmdir /s/q $build";
    96   print "* rmdir /s/q $build\n";
    78   system("rmdir","/s/q",$build);   
    97   system("rmdir","/s/q",$build);   
    79   }
    98   }