Sort directory files by creation datetime in Windows filesystem

On windows the CTime is the creation time, use the following: <?php $files = array(); foreach (new DirectoryIterator(‘/path’) as $fileInfo) { $files[$fileInfo->getFileName()] = $fileInfo->getCTime(); } arsort($files); After this $files will contain an array of your filenames as the keys and the ctime as the values. I chose this backwards representation due to the possibility of … Read more