moving files if they are in a list


I run a community based website and up until now it has only been half dynamic, sometimes i would manually upload files to my server, anyway, in my database I have a table with for each row the file name of the image on disk, i have around 2400 unique files in that table, my problem is that on disk I have 2973 on my local machine, and for some reason i have around 3100 on my server.

What I would like to do is download the folder from the server to my desktop, then query the entire list of unique file names from the database to populate a list, then I want to use the list in an apple script to select each file and move it to a separate folder, at the end of the process i should end up with a folder "up_to_date" containing only the files that are referenced in the database.

Is this possible in applescript? I could produce a list with the file names separated by commas in form of text which i could copy into an applescript?