Python

One good thing about working at Google has been that I’ve finally learnt Python. Properly. Which means I can whip up, in just a couple of minutes, a tested & documented script to, say, replace ~2,500 HTML files with redirects. So now anyone using an old link to any HTML page under http://homepage.mac.com/wadetregaskis will get automagically redirected to the page’s new location, here on http://wadetregaskis.com/ (shoved aside under /MobileMe/Sites/, ’cause in theory I’ll be doing a real website from scratch).

What’s more difficult, however, is updating all the absolute paths and other references to homepage.mac.com within the HTML files, now that they’re hosted on wadetregaskis.com. I did a bunch by hand, then realised there’s over a thousand HTML files in the Photos subfolder that each contain many homepage.mac.com links. Sod.

I had a quick look for a utility to perform this, but found only a handful, and none that support Macs. I’m sure there’s tools out there, probably Perl or Python or Ruby scripts, that would ultimately work, but finding them is probably more trouble than just reproducing them myself.

I also tried BBedit, knowing it had FTP support (but no FTPS, dangerously), but it doesn’t appear willing to perform a search & replace via it. Bollocks.

Maybe I can write another script, but I’ve never done FTPS in Python before. Hmm…

Leave a Reply