Scripting

Migrating Away From .Mac

Apple's homepage.mac.com is nice to get started with, but don't do what I did and build a 130 page site on it. Migrating away from homepage.mac.com is painful: .htaccess files are not recognized, so there is no way to put a 301 permanent redirect on it. There is no custom 404, so any deleted pages just go to a generic Apple 404: no place to put a friendly message telling the user that all the content has moved. Google will now get all confused as it finds the content has gone.

So I'm replacing old pages with individual redirect pages, pretty much by hand. The one remaining problem is replacing more than 500 web pages that represent the permalinks for my home page. These are all in one place and I need to do exactly the same thing to each of them. I would welcome a script (shell, perl, python, Applescript, or anything else I can run) that does the following:

For each html file in the current directory:
Rename the file to "old"+currentfilename
Copy template file to currentfilename
Replace all occurrences of "zzz" in currentfilename with "currentfilename"


The template file is my redirect page. The string zzz in that template file completes a link to the new site.

Any takers?
|
The Bagelturf site welcomes Donations of any size