Steven Macintyre wrote: > retrieve all items from a mysql db table, then check to see if the > files from that table exist on the server (images), if not, to "clean > up" and remove the physical file - so that only the files from the db > exist. When you are comparing the contents of disk vs. db, you have three possible outcomes: 1) file is listed in db, but not found on disk 2) file is found on disk, but not in db. 3) file is found on disk and in db. I think I'd probably read the directories of where the physical files are located into an array = files_in_disk(), then read in the file list from the database into files_in_db(). Use array_diff() to identify the discrepancies, then sort them out (delete file, add row, delete row). for files_on_disk(), lookup opendir() and readdir(). for files_in_db(), lookup mysql_query() and mysql_fetch_assoc(). Will consume a lot of memory if you've got a lot of files. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php