The easiest would be to use a Rename Script (i.e. the Rename command runs the script, instead of the other way around, and all the script does is tell it the new name/path for each folder).
If you want to do it the other way around, add all the things you want to rename to the Command object (e.g. via ClearFiles, AddFiles) and then run the rename command on that. If needed, it can specify a Rename Preset which includes a script with further logic (e.g. if you need to make different choices for different folders).
The topic is resolved, but it looks like there is no way to delete empty folders.
The undocumented command Rename PATTERN="*" TO="{filepath$}*" AUTORENAME RECURSE HERE works fine, I will continue to use it.
The Rename command doesn't have a HERE argument. That argument is undocumented because it doesn't exist. The command is really being parsed as RECURSE=HERE which is the same as RECURSE=AnyRandomString which is the same as just having RECURSE there.
The Rename command isn't the thing to use for deleting things.