I have a directory that contains subfolders of various depth. I want to go through all of them, check if they contain a folder with a certain name, and if that directory exists run a script (let's call this script foo.sh to avoid confusion).
foo.sh should run in the current folder if it finds the target folder. Example:
/A
/subA-1
/subA-2
/target
/subA-3
/sub-subA-3
/target
The command/script I'm looking for shall be ran from /A, and will then go through all subfolders looking for a folder with the name target. Upon entering /subA-2 this condition is satisfied and the foo.sh is then run in /subA-2. Same for /sub-subA-3, but not /subA-3.
foo.sh does not need any input, it just has to be run in the folder containing /target.
foo.sh, that will be simpler in the long run.