in reply to Re: Need help with File::Find
in thread Need help with File::Find
I couldn't get the prune to work with the procedural interface, so here's the OO style answer:
Update: The procedural interface works if you put the first 'file => name ...' rule AFTER the 'not ... => prune' rule (just like it is above in the OO interface).#!/usr/bin/perl use strict; use warnings; use File::Find::Rule; use constant FFR => "File::Find::Rule"; my $ext = qr/\.(?:html|php)$/; my $dirs = qr/^(?:cgi-bin|log)$/; my $base = "c:/blub"; my @files = FFR->or( FFR->directory->name($dirs)->prune->discard, FFR->file->name($ext), )->in($base); print "$_\n" for @files;
|
|---|