Renaming multiple files with rename

I need to rename files in batch–the other questions I browsed don’t exactly address my problem. The names of my files are generated non-deterministically, so I can’t predict what they will be named. I do know that they will start with NORMAL and end with -lib*. I’d like to replace everything in between with some string X. For example,

Using Perl rename to rename files and directories

I’m using the Perl rename command line tool to search recursively through a directory to rename any directories as well as files it finds. The issue I’m running into is the rename command will rename a sub-directory of a file then attempt to rename the parent directory of the same file. This will fail because the sub-directory has been renamed resulting in a “No such file or directory”