dylan
11/7/2017 - 11:10 AM

CleanUp_Cache_Folder()

PHP Clean up cache folder

function CleanUp_Cache_Folder(){
    ## Automatic cleanup Cache folder
   $cache_folder = 'cache/';
    $file_type = '*.mp3';
    $files = glob($cache_folder.$file_type);
      $time  = time();
   
      foreach ($files as $file)
        if (is_file($file))
          if ($time - filemtime($file) >= 60*60*24*1) // 1 days
            unlink($file);
   
}