Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Unlinker.pl

by JSchmitz (Canon)
on May 15, 2001 at 00:03 UTC ( #80324=sourcecode: print w/ replies, xml ) Need Help??

Category: Utility Scripts
Author/Contact Info JSchmitz@linuxmail.org
Description: Uses Perl's unlink to auto-delete numerically named files. Needed this here at work.
#!/usr/bin/perl -w

# Interactive file deleter uses Unlink

print "Enter starting file name: ";
$start = <>;
print "Ending file name: ";
$end = <>;
chomp($start);
chomp($end);

opendir(MDSDIR,"/mds/nvision1");
while ( $file  = readdir(MDSDIR) ) {
if ($file =~ /000[0-9A-C]*\./) {
        $temp = $&;
        chop($temp);
        if ( $temp ge $start && $temp le $end ){
                 $temp = "/mds/nvision1/" . $temp . ".$'";
                  print  "unlinking $temp\n";
                  unlink($temp);
          }

   }
   }
   closedir(MDSDIR);

Comment on Unlinker.pl
Download Code

Back to Code Catacombs

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://80324]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2015-07-08 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls