Skip to Content.
Sympa Menu

internetworkers - Re: [internetworkers] software to clean up web site?

internetworkers AT lists.ibiblio.org

Subject: Internetworkers: http://www.ibiblio.org/internetworkers/

List archive

Chronological Thread  
  • From: Steven Champeon <schampeo AT hesketh.com>
  • To: internetworkers AT lists.ibiblio.org
  • Subject: Re: [internetworkers] software to clean up web site?
  • Date: Fri, 7 Nov 2003 14:32:14 -0500

on Fri, Nov 07, 2003 at 02:24:23PM -0500, Michael Winslow Czeiszperger wrote:
> Can anyone recommend a piece of software for this situation? Our web
> site has gone through many redesigns, and there's now about six images
> directories, and I'm not sure which, if any of the images are actually
> being used. We're getting low on disk space, and I'd like to delete
> unused images, but don't have a good way of telling which images are
> actually be used.
>
> Is there software somewhere that would give a list of the unused images?

It should be easy enough to write a quick find/perl hack that can print
out a list of all the files actually being called via <img>. If you're
using Javascript to do rollovers, or to manage images at all, it gets a
little hairier to detect.

cd $web_doc_root
find . -name '*.html' -exec perl -ne \
'if(/<img.*src="?([^"\s]+)["\s]/i) {
print "found one: $1\n";
}' {} \;

something like that, anyway. You might want to store what you find in
an associative array instead and just print the list at the end. You can
then resolve any relative linking issues (e.g. "../../images/") and go
through and do a find on image files, compare to see if they're in the
list, and voila. Shouldn't take long.

--
hesketh.com/inc. v: (919) 834-2552 f: (919) 834-2554 w: http://hesketh.com
Book publishing is second only to furniture delivery in slowness. -b. schneier




Archive powered by MHonArc 2.6.24.

Top of Page