<?php
 
$directory = "/home/silver/public_html/tresorjewellery/image/cache/TEMP/";
$filecount = 0;
$files = glob($directory . "*");
if ($files){
 $filecount = count($files);
}
echo "There were $filecount files";

if($filecount>3000){
if ($handle = opendir('/home/silver/public_html/tresorjewellery/image/cache/TEMP/')) {

    while (false !== ($file = readdir($handle))) { 
        $filelastmodified = filemtime('/home/silver/public_html/tresorjewellery/image/cache/TEMP/'.$file);

        if((time() - $filelastmodified) > 1*3600)   
        {
		   if(strlen($file)>5){
				//echo $file . ' -- '.  $filelastmodified.'<br>';
				unlink('/home/silver/public_html/tresorjewellery/image/cache/TEMP/'.$file);
		   }
        }

    }

    closedir($handle); 
}
}

$gemjoliVQLogSize=filesize('/home/silver/public_html/gemjoli/vqmod/vqmod.log');
if($gemjoliVQLogSize > 1000000 ){
   unlink('/home/silver/public_html/gemjoli/vqmod/vqmod.log');
   echo '<br><br>Gemjoli VQMod Log File Deleted, since exceeds max. allocated size of ' . $gemjoliVQLogSize . ' / 1000000';
}


$tresorErrLogSize=filesize('/home/silver/public_html/tresorjewellery/system/logs/error.txt');
if($tresorErrLogSize > 1000000 ){
   unlink('/home/silver/public_html/tresorjewellery/system/logs/error.txt');
   echo '<br><br>Tresorjewellery Admin Error Log File Deleted , since exceeds max. allocated size of ' . $tresorErrLogSize . ' / 1000000';

}

?>