Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Rmtree with exclude

by vinoth.ree (Monsignor)
on Dec 01, 2014 at 14:49 UTC ( [id://1108837]=note: print w/replies, xml ) Need Help??


in reply to Rmtree with exclude

Hi,

Here is my quick work around, there may be efficient available.

use strict; use warnings; use Data::Dumper; use File::Find::Rule; use File::Path 'rmtree'; my $directory="/cache"; my @subdirs = File::Find::Rule->directory->in($directory ); print grep {!/$directory\/_.*?$/ and !/^$directory$/ and rmtree($_) } +@subdirs;

All is well

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-03-28 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found