Deleting (cffile) files where the related id does not exist- Coldfusion
Posted on 2014-03-06
I need help figuring out how to delete files in a folder that are no longer needed.
They are image files, which relate to active real estate listings.
When the listing is no longer active I wish to delete this images which are associated to the listing.
My database table only has active listings, it doesn't not have old, deleted or expired.
When my table gets updated (every 20 min) any non actives will be purged from the table, when this occurs I want to be able to delete the associated images from the server..
the naming convention is:
property id = propertyID
Images = IMG_propertyID_1, IMG_propertyID_2, IMG_propertyID_3...
Any help with this would be greatly appreciated.