File creation time [closed]

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 identical ctimes, which would cause an entry in $files to be overwritten.

Edit:

Updated answer to use CTime as the OP clarified he's using Windows.


File creation time does not exist on most operating systems.