Jump to content

Find Most Similar Filename? file_exists()??


kev@num

Recommended Posts

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

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.