0

I am writing a script that needs to scan through a large amount of files (potentially up to 1 million) in a single directory (ext4). I am planning on using the PHP readdir function to create the list.

Since I don't have that amount of files in the directory yet, I don't know if it will work. I know 'ls' and such don't work on that amount of files, but I don't need them to.

So, the question is really only ...will PHP readdir work on 1 million files?

user1227914
  • 3,446
  • 10
  • 42
  • 76

2 Answers2

3

Why would you have so many files? It will kill your performance. Can't you group the data somehow? Or store it in a database? I can't really see how one million files in a sigle directory would make sense. The fragmentation would be enormous. Please give an example of the file you are storing.

AlfredoVR
  • 4,069
  • 3
  • 25
  • 33
0

My answer to my own question, if anyone is wondering, is IT WORKS. I created a script to create 1 million random files and successfully ran the readdir function.

user1227914
  • 3,446
  • 10
  • 42
  • 76