home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / utils / rmtemps.pl < prev    next >
Encoding:
Perl Script  |  1996-07-24  |  383 b   |  29 lines

  1. #!perl
  2. # -*- perl -*-
  3.  
  4. $rm = 0;
  5. if ($ARGV[0] eq "-rm") {
  6.     $rm = 1;
  7.     print "Actually removing files...\n";
  8.     shift;
  9. }
  10.  
  11. open(F, "find . -type f -print |");
  12. while (<F>) {
  13.     $t = 0;
  14.     s/\r//g;
  15.  
  16.     $t = 1 if /\~/;
  17.     $t = 1 if /\#/;
  18.     $t = 1 if /\/[a-h]{8}$/;
  19.  
  20.     if ($t) {
  21.     print;
  22.     if ($rm) {
  23.         s/[\r\n]//g;
  24.         unlink($_) || die("unlink($_)");
  25.     }
  26.     }
  27. }
  28. close(F);
  29.