Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to locate files above a certain size for all directories under '/wwwdev' on my website.

The script below is finding them OK but it's not printing the path of the file for me:

use File::Find; find (\&wanted, 'e:/inetpub/wwwdev'); sub wanted { my $size = -s; if ($size > 102400) { $Find::File::name = $name; print "$name, $size\n"; } }

What have I done wrong?

Replies are listed 'Best First'.
Re: getting directory path to file using File::Find
by Aragorn (Curate) on Nov 07, 2002 at 10:57 UTC
    Hehehe :-) It's just a little typo. Use
    $name = $File::Find::name
    instead of
    $name = $Find::File::name
    The '-w' option to Perl catches this.

    Arjen

    --
    All that is gold does not glitter...

Re: getting directory path to file using File::Find
by cLive ;-) (Prior) on Nov 07, 2002 at 10:29 UTC
    $name = $Find::File::name; print "$name, $size\n";

    d'oh

    cLive ;-)

    Update: LoL d'oh - I fix the typo without fixing the typo - see below :)

      Thank-you!

      Still the same problem though - this is what is printed out:
      , 102700 , 104520
      etc

      The $name variable appears to be blank - what gives?