Print Page | Close Window

Delete orphaned image uploads

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Modifications
Forum Description: Mod's and Add-on's for Web Wiz Forums.
URL: https://forums.webwiz.net/forum_posts.asp?TID=25479
Printed Date: 29 March 2026 at 8:18pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Delete orphaned image uploads
Posted By: sweepR
Subject: Delete orphaned image uploads
Date Posted: 24 March 2008 at 4:44pm
My uploads folder on my site is beginning to get big (and my host's disk space limit is fast approaching) so I was wondering if there was a way to delete uploaded images which aren't used in posts or as avatars.

I'm planning to build a script to do this but before I do I thought I'd ask if someone else hasn't already done something similar? Big%20smile

My plan is to search through the tblThead.Message field pulling out all "<img>" tags and storing the paths in an array (or possibly a temp db table). (The same would be done for avatars.)

Next it would get the images (an paths) stored in the "/uploads/" folder.

Then it would cross check the two deleting those which aren't used in the DB (i.e. in posts & avatars).

The above script could potentially be quite intensive all round - I'm not sure how much so, maybe others can comment. If nothing like this exists I'll start on it and do some testing.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net