wait, you said it works, what's the problem?

Justin Georgeson wrote:

> I just wrote this little script, and was hoping that some perl gurus on
> the list could help out. My intent is to start at a known location and
> go recursively through folders deleting all .java files and any .class
> files compiled from them. Deleting all the .java files isn't difficult,
> I'm just not sure about the other part. Here's the idea though: if there
> is a file "x.java" then delete "x.class" and any files that start with
> "x$" and end in ".class"
>
> #-------------------------------------------
> @Dirs = ("d:\\temp\\src");
>
> foreach $folder (@Dirs)
> {
>   print "\nfolder: ".$folder."\n";
>   chdir ($folder);
>   opendir (DIR,".");
>
>   for (sort readdir (DIR))
>   {
>     if ((/^\.$/) || (/^\.\.$/)) { next; }
>
>     $file = $_;
>
>     if (-d $file)
>     {
>       print "\t".$file."\n";
>       $file = $folder."\\".$file;
>       @Dirs = (@Dirs,$file);
>     }
>     else
>     {
>       @Src = (<*.java>);
>
>       foreach $file (@Src)
>       {
>         print $file."\n";
>
>         $name = $file;
>         $name =~ s/\.java$//;
>
>         @Class = (<$name.class>);
>         @Class = (@Class,<$name\$*.class>);
>         foreach (@Class) {unlink $_;}
>         unlink $file;
>       }
>
>       @Src = ();
>       @Class = ();
>     }
>   }
>   chdir ("..");
> }
> #-------------------------------------------
>
> It seems to work from the limited test cases I've run but would
> appreciate any help.
>
> --
> ------------------------------------------------------------------------
> ; Justin Georgeson                                  "free the mallocs" ;
> ; http://home.austin.rr.com/mastercontrol                              ;
> ; mailto:[EMAIL PROTECTED]                                  ;
> ------------------------------------------------------------------------
> ---------------------------------------------------------------------------
> Send administrative requests to [EMAIL PROTECTED]

--
tom carlile                     [EMAIL PROTECTED]
professional systems wrangler



---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]

Reply via email to