Re: Orphan graphic files - how to find?

by "W. Jeffrey Rankin" <jrankin(at)jeffr.net>

 Date:  Fri, 17 Nov 2000 20:13:54 -0500 (EST)
 To:  Dave Alders <yldman(at)sierra.net>
 Cc:  hwg-techniques(at)hwg.org
 In-Reply-To:  sierra
  todo: View Thread, Original
Hi Dave:

While I don't know of any specific tools that allow you to do this, here's
how I might approach the problem (I think you're thinking on the right
track, you just need to find the proper tools):

1. Output your image directory to a text file, e.g. (while in the
directory containing images):
	dir /B > images.txt

2. Now, use a tool like grep in your html directory and do a search on
something like *.gif, *.jpg, *.png, etc. Depending on the tool you use,
you can output the lines that contain *.gif, *.jpg, or *.png

3. Since step 2 produced entire lines of information instead of
individual filenames, you might want to edit the file so you have just the
image names, or better yet use a tool (awk, sed, perl??) to extract the
filenames for you.

4. Do a file compare on the resulting files produced from the HTML source,
and the image directory.

This approach has an advantage in that it's something you could automate,
and produce a report say, once a week or so.

Tools you might use : grep, grex, cmp (compares files), awk or perl. These
are all widely available and free tools.

Hope this helps!

- Jeff 

===================================================
Jeff Rankin	jrankin(at)jeffr.net

http://www.jeffr.net/

Be Valid To Be Cool
===================================================

On Fri, 17 Nov 2000, Dave Alders wrote:

> Hi,
> 
> I've done a little research and lurked on this list for some time,
> but I can't find an answer to the (simple?) question "how do I check
> for orphan graphics on my site"? I know some HTML authoring s/w
> (e.g., MS FrontPage and DW) has some built-in tools, but how does
> somebody using..um..HS..or a plain text editor (Notepad?)
> methodically check for orphans on their site?  I guess this would
> involve (from a s/w perspective) checking img tags in the html
> files and flagging ones that don't have a match to a graphic on
> the site. I don't need link validation (I think) just a way to tell
> which graphic files are no longer needed.
> 
> Anybody got a bead on some cheap coolware that does this? I
> don't need it for a HUGE site, just about 30 pages or less. Should
> I just put my glasses on and look?  Delete everything and put out
> what's broken (hey, I've done it!).
> 
> Thx,
> 
> Dave
> 
> 

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.