The problem for which the perl code is to be developed is as follow:
There is a root directory that contains several directory in it. Each subdirectory has in turn a text file in it.
We need to go into each directory of the root directory and first rename the file inside that directory. Then we will need to get back, or one directory up, and replace the directory name with the same name as the text file it contains.
Steps:
- open each directory
- rename the text file in the directory opened
- go up one level and rename the directory itself with the same name as the text file it contains
- move to the next directory in the root directory