File Removal after Database Comparison
- From: Chris Owens <chrisowens@xxxxxxxxx>
- Date: Thu, 03 Apr 2008 21:13:46 GMT
Hi all,
I'm trying to figure the logic (and therefor the code) to enable the clean-up of a site I've inherited. Basically I have a folder that has around 6,666 images in it that are loosely related to the information held in a database. I say loosely because the images are uploaded (via FTP) manually. There is no direct reference to the JPEGs in the database, as the code on the site references them via:
<img src="<?=echo ($referenceid); ?>_f.jpg" />
<img src="<?=echo ($referenceid); ?>_s.jpg" />
<img src="<?=echo ($referenceid); ?>_b.jpg" />
Each record in the database has three related images:
Image of the front - recordid_f.jpg
Image of the side - recordid_s.jpg
Image of the back - recordid_b.jpg
Now over time records have been removed from the database, but the images haven't been removed and as such, short of removing all images, there is no easy way that I can think of to clear the folder (several GB of data) whilst keeping the images that have related records in the db.
My question is: How can I through code remove any orphaned images (that aren't needed anymore), whilst keeping the images that still relate to records in the database?
Any assistance/pointers/snippets would be much appreciated.
Kind regards,
Chris
.
- Follow-Ups:
- Re: File Removal after Database Comparison
- From: J.O. Aho
- Re: File Removal after Database Comparison
- From: J.O. Aho
- Re: File Removal after Database Comparison
- From: Preventer of Work
- Re: File Removal after Database Comparison
- Prev by Date: Re: ImageTTFText w/o anti-aliasing @ 11px -> ugly
- Next by Date: Trouble auto-submitting a form with CURL
- Previous by thread: PHP blocks session_start while other PHP instance is running
- Next by thread: Re: File Removal after Database Comparison
- Index(es):
Relevant Pages
|