Web site links problem -- web gurus?

I work for a web-based software company, managing their website. We are currently in the process of moving the files from an NT-based host to a UNIX host (yay!). Anyway, I’ve run across a really, really annoying problem: filenames. You see, when the sites original creators built the pages, they gave files names with alternating case (you know, “titleGraPHIC.GIF”, that kind of thing). Why they did this, I do not know, but its causing all sorts of problems.

The NT webserver, IIS, apparently makes no distinction between cases when dealing with files. UNIX, (and in this case, Apache), does. When the original site designers were doing the pages, they didn’t pay strict attention to the cases of the images, and such, not realizing that it would matter if we switched the site over to UNIX.

Therefore, I’m in a bit of a predicament. I figure the best course of action is to rename all files in completely lower case, and then change all applicable links. I’ve already instructed everyone that from now on, all filenames are to be lowercase only, so this is a standard we will be following in the future.

So, finally, here’s the question: is there any tool out there that can open up a whole bunch (probably five, six hundred html files), grab every link, and then change all links to be lowercase only? I can’t do this through something like Word, since I need to preserve the case of the non-link text. I’ve considered (and actually started) writing a program to do this, but I realize that this will probably take many, many hours.

I’ve tried several linkcheckers, but many only point out broken links (and typically ignore case), rather than doing a mass replacement.

Any thoughts?

Macromedia Dreamweaver has a rather nice whole-site code-level search and replace text edit function, but it would still be a pain to implement, you’d have to search for each instance of each badly spelled name.

Dreamweaver also has a function where if you change the name of a graphic file, it will go through and change every appearance of that file in the site’s code. This all works nicely because it’s all on your local CPU, independent of your HTTP server’s functions. You would merely need to load the entire site into Dreamweaver, then use the program to change each file name. DW will automatically search every HTML file for an occurence of that name, and change them all. ISTR that if you change the names outside of DreamWeaver, but the program is still active, the program will detect the name changes and ask if you want to update all source to reflect the name changes. That way, if you had a gazillion files you need to rename, you could do that with a Perl tool (or something like that) and then DW would handle all the HTML changes. But RTFM before trying this, it’s been ages since I did this trick. And do I need to tell you to back up everything?

[Moderator Hat ON]

Moving to General Questions.

[Moderator Hat OFF]

Wasn’t it already in GQ? If not, my mistake.

As far as I know (and oh, do I hope I am wrong!), there is no editing software that can do a blanket search-and-replace for cases, changing all uppercase letters to lowercase. However, Homesite offers a terrific extended search-and-replace feature, and is my external editor for Dreamweaver. You will have to manually enter in the filenames and links you wish to change, but Homesite will replace every instance of the incorrect version with the correct one throughout the entire site, or any directory you specify. May not be as painless as you’re hoping for, but it sure beats going through the code yourself.

Sorry, meant to add:

On the off chance that you’re on a Mac, BBEdit has the same capabilities, and is available for the Mac platform.

I’m actually using HomeSite now, but I’m not quite up to speed on it yet. I’ll try doing a blanket search and replace – any tips on where I might find this feature?

Under the search menu, it’s called “Extended Replace”

If you use HS to upload your web files, it also has the option to force folder & file names to lowercase.

If you’re using apache, look at mod_speling

A better solution would probably be to write a Perl script to go through all of your webpages and correct the links, followed by a flogging of your development staff.

Under the search menu, it’s called “Extended Replace”

If you use HS to upload your web files, it also has the option to force folder & file names to lowercase.

BTW, my condolonces. We use a mixed system here and I’m always getting screwed by file name cases.

here’s some help on converting the mixed case filenames to lowercase ( using DOS ) :


but i guess the bigger headache is in changing the case of the links contained in the html pages. maybe you could write a C program that opens and reads the files and checks for all mixed case strings that follow “http://” and replaces all the uppercase characters to lowercase. though it might not take many, many hours, it’s still a headache to write, but it looks faster than manually scanning each file, depending on the number of files and links contained therein.

All right, here’s the process:

  1. Open the directory using HomeSite.
  2. Copy a filename or link you’d like to correct.
  3. In the top toolbar, you’ll see File Edit Search etc. You want the Search function.
  4. Click on Search, and in the drop-down menu, select Extended Replace (or ctrl+shift+r).
  5. In the Find What window, paste your incorrect filename.
  6. In the Replace With window, type the correct filename.
  7. Under Find Where, check Match Case.
  8. Also under Find Where, select In folder (should be the site you’re working on, navigate to make sure that’s the case) and check Include Subfolders.
  9. Hit the Replace button, and voila! Corrected code throughout your site.

As you’re getting familiar with this feature, please do make backups before you begin just to be safe. Let me know if anything goes awry.

That was not a double post. You didn’t see it. It didn’t happen.