Display Directory Subfolders
Moderator: General Moderators
-
ibanez270dx
- Forum Commoner
- Posts: 74
- Joined: Thu Jul 27, 2006 12:06 pm
- Location: Everywhere, California
Display Directory Subfolders
Hi,
I need to make a script to display the subfolders of a network directory (for example, \\network\users$\ ) ... I don't think I'm using the dir function correctly, and I don't exactly understand how it works from php.net... can someone help me out?
Thanks,
- Jeff
I need to make a script to display the subfolders of a network directory (for example, \\network\users$\ ) ... I don't think I'm using the dir function correctly, and I don't exactly understand how it works from php.net... can someone help me out?
Thanks,
- Jeff
-
ibanez270dx
- Forum Commoner
- Posts: 74
- Joined: Thu Jul 27, 2006 12:06 pm
- Location: Everywhere, California
How do I use them? Here is my code currently... it won't even show anything - just a blank page...
I haven't used the foreach or glob functions before, and PHP.net doesn't exactly make sense to me... sorry I'm not a pro at this...
Code: Select all
foreach (glob_onlydir("\\network\users$") as $dirname)
{
$display_names .= "$dirname";
}There isn't such function "glob_onlydir"
pickle meant to this:
pickle meant to this:
Code: Select all
glob('*', GLOB_ONLYDIR)-
ibanez270dx
- Forum Commoner
- Posts: 74
- Joined: Thu Jul 27, 2006 12:06 pm
- Location: Everywhere, California
cool - now I don't have just a blank page... using the following code, I only get the output "array". I haven't worked with arrays either...
I need it to basically read all the names of the directories within \\network\users$\ and display them... Please help me!
Code: Select all
$directories = glob('\\network\users$\*', GLOB_ONLYDIR)Figure out arrays here: http://www.php.net/manual/en/function.array.php
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
ibanez270dx
- Forum Commoner
- Posts: 74
- Joined: Thu Jul 27, 2006 12:06 pm
- Location: Everywhere, California
Hi,
Ok, so I got it to display the folder names... but I couldn't get it to display it from the network... (I did the testing in the current directory). However, I need it to go to \\network\users$\ . That is the path it displays from windows explorer, but it won't work in the PHP. Is there anything I'm missing? Here is my code again:
Ok, so I got it to display the folder names... but I couldn't get it to display it from the network... (I did the testing in the current directory). However, I need it to go to \\network\users$\ . That is the path it displays from windows explorer, but it won't work in the PHP. Is there anything I'm missing? Here is my code again:
Code: Select all
<?php
$Array = glob('\\network\users$\*', GLOB_ONLYDIR);
foreach($Array as $dirname)
{
$display_names .= "<a href=viewlog.php?name=$dirname>$dirname</a><br>";
}
?>