Ok, I have a folder containing .jpgs files. I also have a table in the database containing filenames of files I want to keep. How can I deletes files whose filenames are NOT stored in the database. Here's the code I use to list files in the database:
$result = mysql_query("SELECT * FROM pictures2");
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$file = "/home/files/file-".$row['filename'];
//lists file-938493.jpg, file-83943.jpg, etc etc
}
How do I use the unlink function to deletes files that are not on the list? Thanks for any help.