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

Hey,
I'm writing a backup script, based on File::Find to recurse thru directories and pass files on to Archive::Tar.

Is there any way to find out the complete path of a file (passed as $_) in the sub used in find() ?

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.

Replies are listed 'Best First'.
Re: File::Find and current directory
by davorg (Chancellor) on May 11, 2001 at 15:26 UTC

    Let's take a look at the File::Find docs and see what they have to say on the subject...

    $File::Find::dir contains the current directory name, and $_ the current filename within that directory. $File::Find::name contains "$File::Find::dir/$_". You are chdir()'d to $File::Find::dir when the function is called.

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me