Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // removes duplicated files in a dir
- $dir = scandir(".");
- $_md5 = array();
- foreach($dir as $i=>$file) {
- if($file == "." || $file == "..") continue;
- $md5 = md5(file_get_contents($file));
- if(!in_array($md5, $_md5)) {
- $_md5[] = $md5;
- } else {
- unlink($file);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment