List directory on another server

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
SandyD

List directory on another server

Post by SandyD »

Hi all, hoping someone will take pity on me with some PHP code

I have some code (pinched from some google search) that has been added to a user-defined tag and is supposed to give me a list of files in the specified directory.

However, on running it, it only produces the "pre..." and "post" code lines.

I want to use it so that any new procedures added to the directory will be displayed automatically.

Any ideas?

Code: Select all

echo("<h3>--- Pre dir code ---</h3>");

$dir = "\\server\share\procedures";
$dh  = opendir(dirname($dir));
while (false !== ($filename = readdir($dh))) {
   echo($filename . " ");
}

echo("<h3>--- Post dir code ---</h3>");
P.S. The directory is on another server.
Last edited by SandyD on Fri Feb 10, 2006 11:07 am, edited 1 time in total.
cyberman

Re: List directory on another server

Post by cyberman »

SandyD wrote: P.S. The directory is on another server.
Your script needs the full path for the directory ...
SandyD

Re: List directory on another server

Post by SandyD »

Hi cyberman,

can you explain what you mean by "full path"?

And/or possibly show me in code.
cyberman

Re: List directory on another server

Post by cyberman »

SandyD wrote:

Code: Select all

$dir = "\\server\share\procedures";
With this line $dir is set to your server. Cause you wanna read the directory from another server the url must located in this line. But the script must also have the permission to read the external directory ...
SandyD

Re: List directory on another server

Post by SandyD »

Thanks for the info, managed to get it to work
Locked

Return to “CMSMS Core”