Well then, just take the code, take out the rmdir, and put in a rename. What? Are we supposed to write all your code for you? Just setup a test dir/subdir setup, and try renaming, with finddepth, instead of find. Also Google for "File::Find rename dirs"
oh, not at all. I'm quite surprised that after an hour googling I haven't found any ready solution for this problem. Perl has been one of the "big" programming languages for decades and there is no "quick" solution for this simple (for experienced programmer) problem.
F*$k, I have 10 or 15 examples in my personal library, for finddepth. They are quite easy to find if you are an experienced "googler".. :-) And if you can't change a line of code from "rmdir" to "rename" , maybe you should HIRE someone who can? This is not a free coding service.
I just googled " File::Find finddepth " and got useful code from at least 5 threads.