Execute multiple files in multiple folders and also output on same folder

How to execute multiple files in multiple folders and also output to be generated in the same folder?

Hello Team,

I have a path like Sanity_test/*/* and it has around 100+ folders inside with files. I would like to run/execute those files and output of execution to be placed on same / appropriate folder.

Can anyone help me how to achieve in shell scripting?

Thanks & regards,
Raj

Assuming your folders & subfolders only contains the files you have to execute
Something like (may need some tweak but for inspiration)

find ./Sanity_test -xdev -type f -a ! -type d | while read x; do sh $x > $x.log; done

feel free to tweak and adapt to your needs

1 Like