Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Recursive search and delete

by zentara (Archbishop)
on Nov 16, 2012 at 10:54 UTC ( #1004169=note: print w/ replies, xml ) Need Help??


in reply to Recursive search and delete

And a File::Find example: ( the regex probably needs improvement :-) )

#!/usr/bin/perl # delete all of the *.xml* files recursively use File::Find qw(find); @ARGV = qw(.) unless @ARGV; find sub { return unless -f; return unless $_ =~ /(.*).xml(.*)/; unlink $_ and warn "deleted $_\n"; }, @ARGV; # it would be good to show all dirs to be deleted # and promp user for 'yes' __END__

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh


Comment on Re: Recursive search and delete
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-07-25 21:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls