Answer the question
In order to leave comments, you need to log in
How to delete files by date?
There are about 80,000 files in one folder on the hosting.
Through FTP, the client shows only 10 thousand at a time. Explorer in CPANEL does not load such a folder.
There is no SSH access to the hosting.
The task is to remove the old ones from these files (before a certain date).
How to do it quickly and easily?
Answer the question
In order to leave comments, you need to log in
UPD. I asked myself and found the solution myself.
Found a PHP script that deletes files in a directory older than the specified number of days. Works smart. mb help someone
<?
$days = 100;
$dir = dirname ( __FILE__ );
$nofiles = 0;
if ($handle = opendir($dir)) {
while (( $file = readdir($handle)) !== false ) {
if ( $file == '.' || $file == '..' || is_dir($dir.'/'.$file) ) {
continue;
}
if ((time() - filemtime($dir.'/'.$file)) > ($days *86400)) {
$nofiles++;
unlink($dir.'/'.$file);
}
}
closedir($handle);
echo "Total files deleted: $nofiles \n";
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question