> > find {
> > preprocess => sub { grep( /My\s+Documents/, @_) },
> > wanted => sub { print "$File::Find::name\n"}
> > }, 'c:/test2';
>
> Firstly don't forget that Windows treats the 'My Documents' directory
> as a special case. Windows Explorer shows it at the same tree level
> as My
James Kipp wrote:
> Steve's suggestions worked great for ignoring or not recursing
> directories, but I am unable to filter out all directories not named
> "My Documents" . I have tried using regex and grep to filter them out
> but no luck
>
> this fails, just goes to the root directory and exits,
James Kipp <[EMAIL PROTECTED]> writes:
>
> Thanks Steve.
> So I could use either one of these methods, like:
>
> # skip dirs with Profile
> find {
> preprocess => sub { grep !/Profile/, @_ },
> wanted => sub { print if ($File::Find::name =~ /.*\.pst$/) }
> }, 'f:/users/user1';
Steve's suggestions worked great for ignoring or not recursing directories,
but I am unable to filter out all directories not named "My Documents" . I
have tried using regex and grep to filter them out but no luck
this fails, just goes to the root directory and exits, and the docs really
don't sa
> Of course.
>
> #!/usr/bin/perl -l
>
> use File::Find;
> use warnings;
>
> #
> # ignore
> #
> find {
> preprocess => sub { grep $_ ne __FILE__, @_ },
> wanted => sub { print }
> }, ".";
>
> #
> # don't recurse
> #
> find sub {
> if ($_ eq __FILE__) { ++
James Kipp <[EMAIL PROTECTED]> writes:
> Is there a way to get File::Find to TOTALLY ignore a directory??
Of course.
#!/usr/bin/perl -l
use File::Find;
use warnings;
#
# ignore
#
find {
preprocess => sub { grep $_ ne __FILE__, @_ },
wanted => sub { print }
}, ".";
Fowler To: [EMAIL PROTECTED]
Subject: Re: Help with File::Find
On Fri, Jan 11, 2002 at 10:57:48AM -0600, [EMAIL PROTECTED] wrote:
> all files (including the previously missed ones) are printed out (also
> along with the directories now) as expected, but for the files that would
> not have passed the (-e $_) test, the values assigned for filesize and age
> in
nton Gibbs"
farms.com>cc:
Subject: Re: He
Nick D Montpetit wrote:
>
> Hi Everyone!
Hello,
> I'm fairly new to Perl, and completely new to submitting to the list, so
> please be easy on me. :-)
I'll try.
> The purpose of the code I wrote (listed below) is to go through the current
> directory and all of its subdirectories and report
I meant to post my original code, where line 11 used the -f file test (so
that directories wouldn't be included in the output). My questions still
apply when using -f instead of -e. If we could refer the email below for
future discussion, that would be great! Sorry about the screwup. :-)
Than
> [EMAIL PROTECTED]
cc:
01/11/02 11:06 AMSubject: RE: Help with File::F
Something I just found via a google search...
foreach (@_) {
$min = $_ if $min > $_;
}
$min now holds the smallest value of the array.
BTW, shouldn't line 21 be write $fileref STDOUT? I've not gone over the
code, but if you are looking for the smallest array value, then only writing
out
> 8:
> 9: sub wanted{
> 10: my $flag = 0;
> 11: if (-e $_){
> 12: push(@filelist, [$File::Find::name, -s $_, -M $_]);
don't know if you need the -e here, it is redundant. you might want to use
-f test to just find and stat regular files. here is a snip from a script i
did and use alot and
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 11, 2002 11:58 AM
> To: [EMAIL PROTECTED]
> Subject: Help with File::Find
>
>
> Hi Everyone!
>
> I'm fairly new to Perl, and completely new to submitting to
> the list, so
> please be easy
$_ in the Find::File setup has only the filename. You need to check
$Find::File::name which holds the full filename.
Wags ;)
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 11, 2002 08:58
To: [EMAIL PROTECTED]
Subject: Help with File:
16 matches
Mail list logo