Rename script, a little tricky, giving me trouble adjusting

Please see Formatting tips specific to the Opus forum (also linked at the top of the post editor if you ever need to refer back to it) for how to post code blocks, so we don't have to keep fixing your posts.