There are so many little and no-so-little programs out there for Mac that enable one to, say, validate a DTD, perform XSL transforms, or even batch rename some files. For some reason, I often find myself trying them out (the latest candidates were Editix, Oxygen, Renamer4Mac, etc.). At the end of the day, I always find myself back in XEmacs, doing the job faster and with less fuss. On the other hand, (X)Emacs tends to be fairly opaque, and it’s easy to forget stuff, so:
Since I always forget how to do a batch rename, here’s how: Select the files you want to rename by marking them in dired (‘m’ or use a regexp), then using the Regexp menu, select Rename… (or type % R). Then in the minibuffer, type the ‘from’ regexp (^.*$ selects the entire filename), hit return, and then the ‘to’ regexp. For example, % R ^.*$ <ret> x-& </ret><ret>' prepends an
x-‘ to the filenames.
You can also use a grouping construct in a regexp to remember part of the original expression. For example, by surrounding part of the name in (…), we can refer to it later with a n, where the n is the occurrence of the match. For example, ^x(.)$