I wrote a little shell script (runs in Terminal) which does the opposite of what you state (i.e. it tags the file based on the name, assuming the name is in the form of artist - title - album.mp3) that tags all .mp3 files in a folder using a little command line utility called id3v2. I suppose one could modify it to rename a file based on a tag. Here's the code:
--------
# The bash for built-in is kind of stupid when dealing with whitespace...
# or feature filled depending on your point of view. From my point of view,
# it's stupid. So, in order for uh, for to deal with song names with whitespace
# we must convert the whitespace to something else so for doesn't do
# this loop for each WORD, rather than each line. sed to the rescue!
ls *.mp3 > stupidfile.tmp
for tune in `cat stupidfile.tmp | sed s/' '/~/g` ; do
# assign loopy var to working var that sed puts back
# since we're now in the loop we can get away with this
TUNENAME=`echo ${tune} | sed s/~/' '/g`
ARTISTE=`echo $TUNENAME | awk -F \ \- '{print $1}'`
TITLE=`echo $TUNENAME | awk -F \ \- '{print $2}' | sed s/' '//`
ALBUM=`echo $TUNENAME | awk -F \ \- '{print $3}' | sed s/'_'/':'/g | sed s/.mp3// | sed s/' '//`
# For some reason, we have to do it this way
echo id3v2 -2 -a \"$ARTISTE\" -t \"$TITLE\" -A \"$ALBUM\" -g 20 \"$TUNENAME\" >> tagemid3v2.shl
sh tagemid3v2.shl
# clean up your toys when you're done timmy
rm -f stupidfile.tmp tagemid3v2.shl
done
--------
id3v2 is a darwin ports program which can tag, display and do a bunch of other stuff from the command line. One could modify the code to have id3v2 to extract the tag information and then do a rename much in the same way (though perhaps without all that "sed-in' and awk'n", perhaps with perl) for all mp3s (or .aac or whatever format the music is in) in a given folder. I've actually thought of writing that, but just haven't gotten around to it.