in reply to Re^2: Reading entire subfolder tree into an array
in thread Reading entire subfolder tree into an array

Based on all your input, I have spent the last few hours readin up on find::file and believe it is the best way to go. However, i do have one remaining question.

First, herre is my code I have come up with:

use File::Find; finddepth (\&RetrieveAll, "c:\\fpx"); sub RetrieveAll { push (@list,$_,"\n"); }

How do I get $_ to include the absolute path of the file? $_ lists the folder name, then all files within it... i'd rather have the absolute path.

Is this simple?

Please advise
Simon

Replies are listed 'Best First'.
Re^4: Reading entire subfolder tree into an array
by Aristotle (Chancellor) on May 28, 2002 at 19:41 UTC
    perldoc File::Find says:
    The wanted() function does whatever verifications you want.
    $File::Find::dir contains the current directory name, and $_ the current filename within that directory. $File::Find::name contains the complete pathname to the file.
    Btw - what's that "\n" do there in the push()? :-)
    ____________

    Makeshifts last the longest.
Re: Re: Re: Re: Reading entire subfolder tree into an array
by weini (Friar) on May 29, 2002 at 06:03 UTC
    Hi Simon, you just have to use the module variable $File::Find::name instead of $_. It's as easy as that. So your code will look like

    use File::Find; finddepth (\&RetrieveAll, "c:\\fpx"); sub RetrieveAll { push (@list,$File::Find::name,"\n"); }

    HTH

    weini