Dot and Dubble Dot directory names
- From: webmaster@xxxxxxxxxxxxxxx (Tony Frasketi)
- Date: Fri, 26 Aug 2005 18:52:14 -0500
In a program such as the following.... ----------------------------------------------------------------- #!/usr/local/bin/perl -w
$windir = "/home/users/tony";
opendir(NT, $windir) || die "no $windir?: $!";
while ($name = readdir(NT)) { # scalar context, one per loop
print "$name\n"; # prints ., .., system.ini, and so on
}
closedir(NT);
exit;
-------------------------------------------------------------------
$name returns each of the files in the given directory. To form the absolute path of the files given by $name, you would simply combine the $windir and the $name variables like so: "$windir/$name". For example "/home/users/tony/x.txt".
My question relates to the two files '.' and '..'. Is there any function that will give the absolute path of these directories when fed $name values of '.' and '..' ? Without having to chdir to these directories, that is.
I hope I've posed my question so as to be understandable... I've looked online and in the O'reilly books but can't find the answer.
TIA Tony Frasketi
.
- Follow-Ups:
- Re: Dot and Dubble Dot directory names
- From: JupiterHost.Net
- Re: Dot and Dubble Dot directory names
- Prev by Date: Re: Directories into arrays, again.
- Next by Date: Re: Dot and Dubble Dot directory names
- Previous by thread: PLEASE HELP
- Next by thread: Re: Dot and Dubble Dot directory names
- Index(es):