I have 500 folders and each folder contains about 5 files. I want to rename those files and include folder name with it.
My folders (sample1_1, sample2_2, sample3_3) look like this:
Now, I want to rename in a way that files look like this:
In other words, I the following 2 things to be changed:
- Include folder name in the file but after removing last part of it.
- Remove middle part of the file i.e. permissive, orig etc.
Any linux expert here please help me in writing the script.
Many thanks in advance!