Jose Torres wrote at Wed, 29 May 2002 16:41:23 +0200:
> Thanks for your help everyone. I had a related question. It looks like readdir just
>return
> relative filenames and not absolute ones. Is there a way/method to return absolute
>filenames? For
> example, if I'm in /home/docs that has a text file (foo.txt) and I call readdir, I
>want to return
> /home/docs/foo.txt instead of just foo.txt. I could theoretically just append
>foo.txt to a
> "/home/docs/" prefix, but I'm trying to make my code more generic and not hard-code
>everything if
> possible. Thank you.
>
>
It's not a big matter.
my $path = "/.../";
opendir DIR, $path or ....;
my @full_paths = map {"$path$_"} readdir DIR;
closedir DIR;
Now @full_paths contains what you need.
Greetings,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]