Do you know which files have changed from the database tables? For example, something in the database indicates that the item is new or modified? Then it is easy to populate a list of files to check. Are the files ever modified or are they only added (and deleted)? Then you don't need to check modified times, just if the files exists or not.