<?php

function rscandir($path) {
  foreach (scandir($path) as $dir) {
    if ($dir=='.' || $dir=='..') continue;
    $dname = $path.'/'.$dir;
    if (is_dir($dname)) rscandir($dname);
    else {
      if (substr($dname, -3)=='.js' || preg_match('@^blogs/[0-9]+/entrythumb/[0-9]+.jpg$@', $dname) ||
         ($dir == "DEMO.jpg" && filesize($dname) == 5744) || ($dir == "mau.jpg" && filesize($dname) == 6869)) {
        echo "delete $dname\n";
        unlink($dname);
      }
    }
  }
}

rscandir($argv[1]);
