Guest User

Untitled

a guest
Sep 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. /**
  2. * Obtiene la lista de archivos del directorio especificado
  3. * @param string $directory
  4. * @return array listado de archivos
  5. */
  6. function getDirectoryList ($directory)
  7. {
  8.  
  9. // create an array to hold directory list
  10. $results = array();
  11.  
  12. // create a handler for the directory
  13. $handler = opendir($directory);
  14.  
  15. // open directory and walk through the filenames
  16. while ($file = readdir($handler)) {
  17. // if file isn't this directory or its parent, add it to the results
  18. if ($file != "." && $file != "..") {
  19. $results[] = $file;
  20. }
  21. }
  22.  
  23. // tidy up: close the handler
  24. closedir($handler);
  25.  
  26. // done!
  27. return $results;
  28. }
Add Comment
Please, Sign In to add comment