Jump to content

Dont output directory's hidden files of my PC


nareko

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...