<?php
function recentFiles(string $root, int $days): array {
$cutoff = time() - $days * 86400;
$out = [];
$it = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS)
);
foreach ($it as $file) {
if ($file->isFile() && $file->getMTime() >= $cutoff) {
$out[] = $file->getPathname();
}
}
return $out;
}
print_r(recentFiles('/var/www', 1)); // everything touched in the last 24h
Create a free account and build your private vault. Share publicly whenever you want.