I have a directory containing multiple directories. here is an example of the list of directories:
- dir1_out
- dir2_out
- dir3_out
- dir4_out
Each directory contains multiple files. For example folder1_out contains the following files:
- file1
- file2
- file3
In the same fashion other directories contain several folders. I would like to add the name of each directory to file name in the corresponding directory. I would like to have the following result in first directory(dir1_out):
dir1.file1
dir1.file2
dir1.file3
Since I have around 50 directories I would like to write a loop that takes the name of each directory and add the name to the beginning of all subfiles.
Do you have any idea how can I do that in linux.