<?php

  $dbh = new PDO('mysql:host=115.84.178.137;dbname=tvtl', 'violet', 'bk,,123~~');
  $path = $argv[1];
  $temp = (@$argv[2] != null)? $argv[2]: 'temp';
  foreach (scandir($path) as $dir) {
      if ($dir=='.' || $dir=='..') continue;
      if ($dbh->query("select count(*) from tblblog where bl_id=$dir")->fetchColumn() == 0) {
          echo "mv $path/$dir $temp/\n";
          exec("mv $path/$dir $temp/");
      };
  }

