mysql / file hash question -
mysql / file hash question -
i'd write script traverses file tree, calculates hash each file, , inserts hash sql table file path, such can query , search files identical. recommended hash function or command tool create hashes extremely unlikely identical different files? b
you can utilize md5 hash or sha1
function process_dir($path) { if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($path . "/" . $file)) { process_dir($path . "/" . $file); } else { //you can alter md5 sh1 // can set hash database $hash = md5(file_get_contents($path . "/" . $file)); } } } closedir($handle); } }
if working in windows alter slashes backslashes.
mysql hash duplicates directory
Comments
Post a Comment