Get list of files in a directory by date modified with PHP
If you need to go a directory with PHP and get changed on a specific date files, you can easily get to this feature I created a few days ago.
As we see, only you have to go through the directory and day. If we do not catch function on the current day to search.
function getFilesFromDate( $dir , $day =null){ if ( $day ==null) $day = time(); // Leo todos los ficheros de la carpeta $dir = opendir( $dir ); while ( $file = readdir( $dir )){ if ( $file != '.' && $file != '..' && is_file ( $dir . '/' . $file ) && date ( "Ymd" , $day )== date ( "Ymd" , filemtime ( $dir . '/' . $file ))){ $arrfiles [] = $file ; } } closedir ( $dir ); return $arrfiles ; } |
As we see, only you have to go through the directory and day. If we do not catch function on the current day to search.
Comments
Post a Comment