Jump to content

DirectoryIterator not working -- HELP


KaptainBlazzed

Recommended Posts

I have a script the iterates through my directories allowing users to transverse and download files.

 

It was up and running just fine until i switched servers, both were running PHP 5.x.x and ISS 7.

 

The issue is no matter what directory i run the script in, the DirectoryIterator returns a bunch of "." or a "$Recycle.Bin" if i set it to the look in "C:/"

 

 

Here is the code:

<?

$cwd = "c:/";

foreach (new DirectoryIterator($cwd) as $file) {

echo $file->getFilename(). "\n";

}

?>

 

Here is the output from "C:/"

$Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin $Recycle.Bin

 

Here is the output if is set $cwd to "."

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

 

I can not figure this out and am beginning to think it is a permissions issue. :shrug:

 

any help would be appreciated.

 

Link to comment
Share on other sites

getcwd() returns the following

 

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

 

 

I have tried it in several different directories, including my web root and it always returns the same result, a bunch of "."

 

i do however get a different # of "." depending on the directory.

Link to comment
Share on other sites

Try that and postback the output:

 

$dir = new DirectoryIterator(dirname(__FILE__));
foreach ($dir as $fileinfo) {
    if (!$fileinfo->isDot()) {
        var_dump($fileinfo->getFilename());
    }


}

 

No output because they are all "."

 

This is really starting to bug me and i can not figure it out.

 

Could it be a setting in the config file?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.