I am trying to write a bash script that is iterating through sub directories where parts of the path are identical. Maybe best is to show an example:
Directories:
- /path/same/
- /path2/same/
- /path3/same/
Then I want to "do something" to all files contained in those directories and save them in another of those sub directories.
Results:
- /path/another/
- /path2/another/
- /path3/another/
I guess it has to be done with some kind of
for i in /*/same/* ; do
... do something with $i ...
done
loop, but somehow all I try ends up not returning anything in $i.
any tips? thanks :)


for i in /*/same/*; dosearches only for directories two levels from the system root (/var/same,/home/sameetc) - you probably want*/same/*or./*/same/*. – chronitis Feb 6 at 14:08