Jump to content

Dont output directory's hidden files of my PC


Recommended Posts

Hello ...I just was trying to output the file names of different folders in my PC using PHP code...But I found that it outputs actually more than visible files in that particular folder..So what did I mean by visible that when I count the number of files in my folder it appears 18 but when i output it appears that the numer is 20. That two files are not visible. One if the is "Folder.jpg" and the second of them is a ".doc" file i opened and think it is inserted by "Administrator".....This is the code

<?php function getDirectoryList ($directory)    { 	// create an array to hold directory list 	$results = array(); 	// create a handler for the directory 	$handler = opendir($directory); 	// open directory and walk through the filenames 	while ($file = readdir($handler)) { 	  // if file isn't this directory or its parent, add it to the results 	  if ($file != "." && $file != "..") { 		$results[] = $file; 	  } 	} 	// tidy up: close the handler 	closedir($handler); 	// done!   return $results;   }   $array_1=getDirectoryList("C:\Documents and Settings\Администратор\Мои документы\Downloads");    foreach($array_1 as $value)  {  echo "<br/>".$value;  }?>

So here is my question ...how can I output only that 18 files and not that invisible files ? Since I want to work only with files that I see.Please be gentle and help me.

Edited by nareko
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...