Re: Subdirectory ain't directory
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Mon, 11 Feb 2008 20:58:33 -0500
Mandor wrote:
Hi.
I am writing a function that takes a given path and displays subdirectories and files with proper description: "file" or "directory". I have written the following code:
function list_dir($dir)
{
if (!is_dir($dir))
{
exit;
}
else
{
print($dir."<br />");
}
$my_list = opendir($dir);
while (($file = readdir($my_list)) != FALSE)
{
if ($file != "." && $file != "..")
{
if (!is_dir("$dir/$file"))
{
$desc = "file";
} else {
$desc = "directory";
}
echo $desc.": ".$dir."/".$file."<br />";
}
}
closedir($my_list);
return 0;
}
With the tree:
/home/me/public_html/temp <- directory passed to my function
/home/me/public_html/temp/01 <- directory
/home/me/public_html/temp/02 <- directory
/home/me/public_html/temp/test.txt
it shows that all items are files. Directories are chmod'ed 744 - all of them. The owner and group are set the same as for the ../../public_html. Can someone look inside my code and see what I have messed up?
Kind regards.
Works fine here. I'm on Windows, but don't see that that should make a difference, but I can't test on Unix from this particular machine.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- Subdirectory ain't directory
- From: Mandor
- Subdirectory ain't directory
- Prev by Date: Re: Xpath encoding problem
- Next by Date: imagecreatefrompng() undefined... need help!
- Previous by thread: Subdirectory ain't directory
- Next by thread: Re: Subdirectory ain't directory
- Index(es):
Relevant Pages
|