Skip to content

Instantly share code, notes, and snippets.

@raa0121
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raa0121/c846db995385051b3f2d to your computer and use it in GitHub Desktop.
Save raa0121/c846db995385051b3f2d to your computer and use it in GitHub Desktop.
<?php
define("YESTERDAY_DT", "2014-06-01 00:00:00");
function getCurrentTime() {
$dt = new DateTime();
$dt->setTimeZone(new DateTimeZone('Asia/Tokyo'));
return $dt->format('Y-m-d H:i:s');
}
function getFileList($dir) {
$files = glob(rtrim($dir, '/') . '/*');
$list = array();
foreach ($files as $file) {
if (is_file($file)) {
$filetime = date("Y-m-d H:i:s.", filemtime($file));
if ( strtotime(YESTERDAY_DT) < strtotime($filetime) and strtotime($filetime) < strtotime(getCurrentTime()) ){
$list[$file] = $filetime;
}
}
if (is_dir($file)) {
$filetime = date("Y-m-d H:i:s.", filemtime($file));
if ( strtotime(YESTERDAY_DT) < strtotime($filetime) and strtotime($filetime) < strtotime(getCurrentTime()) ){
$list = array_merge($list, getFileList($file));
}
}
}
return $list;
}
var_dump(getFileList("/srv/http"));
//echo getFileList("/srv/http");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment