Search code examples
phpdirectoryscandir

Scanning the C Directory with Scandir


In PHP I am trying to use the scandir() method to get all of the directories in C:. However, I keep getting the error that the directory does not exist.

Error: scandir(C:): failed to open dir: No such file or directory

My code is as follows:

$content = scandir('C:'); 

Could the issue be caused by my code being in a directory checked out of SVN?


Solution

  • I think you should try this example:

    $files1 = scandir("C:\\");
    print_r($files1);
    

    Hope this helps,