nareko Posted July 4, 2011 Share Posted July 4, 2011 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 More sharing options...
justsomeguy Posted July 5, 2011 Share Posted July 5, 2011 The other files are marked as hidden or system files by Windows. There's a comment on this page about how to execute a system command to check for the hidden or system attributes under NTFS:http://php.net/manual/en/function.filetype.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.