Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2016-10-23 15:47 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (301 votes). Check out past polls.