I'm trying to all count files in a home dir and all subdirs *except* a
subdir called 'backup'.

How do I that? thanks in advance.


#!/usr/bin/perl
use warnings;
use strict;
use File::Find;


my $dir = ("/home/foo");
my $counter = 0;

find( { wanted => \&process, no_chdir => 0 }, $dir );

sub process {

          return if ($_ =~ m/^\./); #skips . and ..
          return if $File::Find::dir eq "backup";  #tried File::Find::name as
well..no joy.
          $counter++;
}
print "I found $counter files\n";


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to