diff --git a/tools/md-thumb-restore.php b/tools/md-thumb-restore.php index 77e30a30..2f3c01b9 100755 --- a/tools/md-thumb-restore.php +++ b/tools/md-thumb-restore.php @@ -27,7 +27,20 @@ $newdir=$data_dir.sprintf('%05d',floor(($duuid2[0]+0.1)/100)*100).'-'.sprintf('%05d',ceil(($duuid2[0]+0.1)/100)*100-1)."/".$duuid2[0]; print $dir."\n"; $dir=$backup_dir.trim($duuid2[1]); + @rrmdir($newdir); rename($dir,$newdir); } } + function rrmdir($dir) { + if (is_dir($dir)) { + $objects = scandir($dir); + foreach ($objects as $object) { + if ($object != "." && $object != "..") { + if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object); + } + } + reset($objects); + rmdir($dir); + } + } ?> \ No newline at end of file