kev@num Posted March 3, 2010 Share Posted March 3, 2010 Hi, I'm using the following code to read filenames stored in my MYSQL DB and PHP to see if each file exists in a particular folder : <?php do { //loop through filenames in DB if (file_exists($directory.$row_Recordset1['filename'])) { } else { echo $row_Recordset1['filename']; //show the file that doesn't exist } } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> This is great in showing me which files haven't been uploaded or the filename is wrong in which case i'll rename it manually. So my question is: Is there a way for it to show me the filename that matches best in that particular directory? Maybe using something like similar_text() or levenshtein() ? -if this is possible i could then make a button to rename the wrongly named file on approval! the script above is my first php script looking/using files/directories etc, i've searched the net but can't find anything like this (yet) any help would be much appreciated. thanks in advance kev. [MySQL 5.0.32 | PHP Version 5.2.0] Link to comment https://forums.phpfreaks.com/topic/193983-find-most-similar-filename-file_exists/ Share on other sites More sharing options...
teamatomic Posted March 3, 2010 Share Posted March 3, 2010 http://www.phpfreaks.com/forums/index.php/topic,289881.0.html Link to comment https://forums.phpfreaks.com/topic/193983-find-most-similar-filename-file_exists/#findComment-1020934 Share on other sites More sharing options...
kev@num Posted March 25, 2010 Author Share Posted March 25, 2010 I've had a look, and think I need to use levenshtein() in PHP but not sure how to implement it Link to comment https://forums.phpfreaks.com/topic/193983-find-most-similar-filename-file_exists/#findComment-1031569 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.