Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: deleting a file

by JSchmitz (Canon)
on Jun 04, 2001 at 20:29 UTC ( #85525=note: print w/ replies, xml ) Need Help??


in reply to deleting a file

Use unlink - something like this although this is for files with a specific numeric naming convention

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 Re: deleting a file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-07-03 12:52 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 (53 votes), past polls