Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP most efficient way to list the files in a very large directory [duplicate]

Tags:

Possible Duplicates:
Get the Files inside a directory
PHP: scandir() is too slow

I have a directory with tens of thousands of files in it and I want to display a list of these files on a page. I tried doing it with scandir and it takes forever. What would be an efficient method of achieving this?

like image 481
John Avatar asked Mar 30 '11 07:03

John


Video Answer


1 Answers

I recommend using DirectoryIterator or RecursiveDirectoryIterator.

like image 104
eisberg Avatar answered Sep 17 '22 15:09

eisberg