php opendir not working

I want to scan for all folders and files within folder c:/data
But i am getting below error.
Warning: opendir(c:/data,c:/data): The system cannot find the file specified. (code: 2)
	function listFolderFiless($dir){
    $ffs = scandir($dir);
    $i = 0;
    $list = array();
    foreach ( $ffs as $ff ){
        if ( $ff != '.' && $ff != '..' ){
            if ( strlen($ff)>=5 ) {
                if ( substr($ff, -4) == '.php' ) {
                    $list[] = $ff;
                    //echo dirname($ff) . $ff . "<br/>";
                    echo $dir.'/'.$ff.'<br/>';
            if( is_dir($dir.'/'.$ff) ) 
    return $list;

Open in new window

But  result is same
LVL 15
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ahmed MerghaniSoftware EngineerCommented:
I think your path should be c:\data
InsoftserviceAuthor Commented:
Tried even that
even tried giving hard code value.

This code worked on my local server but not on windows 2003 server

function ListIn($dir, $prefix = '') {
              $dir = rtrim($dir, '\\/');
              $result = array();

                  $h = opendir($dir);
                  while (($f = readdir($h)) !== false) {
                    if ($f !== '.' and $f !== '..') {
                        if (is_dir("$dir/$f")) {
                          $result = array_merge($result, $this->ListIn("$dir/$f", "$prefix$f/"));
                        } else {
                          $result[] = $prefix.$f;

              return $result;
Dave BaldwinFixer of ProblemsCommented:
This works fine for me.
$handle = opendir('C:\\Food')

Open in new window

OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Ahmed MerghaniSoftware EngineerCommented:
Ok. I tested the code and it runs successfully either c:/data or c:\data - and some times it need to be c:\\data-. What is your PHP version? what OS you are using? Are you sure the folder "data" is existed?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
InsoftserviceAuthor Commented:
windows 2003 server . php5.4
InsoftserviceAuthor Commented:
Client had given permission to the folder on the server.
Its  resolved thx
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.