I use the function readdir and select files in directory. I read files in rotation and write them to the database.
But files rotating in random, and file, which was created earlier can write after file, which created later.
How I can read files, sorting them by date of creation? I can do this easy? Without the use of arrays and sorting files there, etc…
if ($dir_handle = opendir ($dir)) {
while (false !== ($file_name = readdir($dir_handle))) {
if (is_file($dir.$file_name)){
...............
You cannot easily read files sorted by date of creation, without using arrays and other calls to get creation date and sorting them… well I suppose you could make an
exec()call instead, but that’s frowned upon…