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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -