Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
10582 lgm 1
<?php
2
/**
3
 * delete all *.cache files from the ./cache folder
4
 */
5
$thePath = './application/cache/';
6
echo '<br />Locating and deleting *.log and *.sql files from this folder: ' . $thePath . '<br />';
7
$counter = 0;
8
if ($theDir = @dir($thePath)) {
9
  while ($theFile = $theDir->read()) {
10
    if (is_file($thePath . $theFile)) {
11
      if (preg_match('/\.cache$/', $theFile) > 0 ) {
12
        echo '<br />Removing file: ' . $thePath . $theFile;
13
        unlink($thePath . $theFile);
14
        $counter++;
15
      }
16
    }
17
  }
18
  $theDir->close();
19
}
20
unset($theDir, $theFile);
21
echo ($counter == 0) ? '<br />No files found matching the criteria.' : '<br />Done';