This AppleScript will move or delete messages that are over a certain number of days old in Mail. By default, it will move messages that are 160 days or older to a mailbox called Archive and display a dialog box for each mailbox it is processing. You can change any of this by adjusting the parameters at the top of the script.
I really wanted to display a progress bar, but I couldn't find an easy way to do it without requiring a plug-in.
[robg adds: To use this script, paste the text into Script Editor, then save it to your user's Library -> Scripts -> Mail folder. I haven't tested this one (my Mail is already sorted into numerous folders based on content), so I'm not sure if it's 10.4 only or not. Note that the script will move messages by default; if you'd like to just delete old mail instead, remove the DestinFolderName entry on the second line (i.e. set DestinFolderName to "").]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20050722103136544