/** * 去除重复的图片文件 * by bbs.it-home.org */ exec("find . -type f", $lines); $arr = array(); $del = array(); $n = 0; foreach($lines as $line){ $line = trim($line); if(!$line){ continue; } $n ++; $md5 = md5_file($line); if(isset($arr[$md5])){ $del[] = $line; //echo "$n del $line\n"; unlink("{$line}"); }else{ $arr[$md5] = 1; } } echo "del " . count($del) . " files\n"; //echo join("\n", $del); 复制代码