I have a series of folders containing multiple files:
-Scenario_1
---- file_1.txt
---- file_2.txt
---- file_3.txt
-Scenario_2
---- file_1.txt
---- file_2.txt
---- file_3.txt
I wish to iterate over each folder, iterate through the files and apply a function to all of these files
build () {
for folder in ./scenarios/*; do
echo "Working on" $folder
`function` (space separated list of files in the folder) -o $folder/output.txt
done
}
build
As an example command, it would look like this:
function file_1.txt file_2.txt file_3.txt -o $folder/output.txt
I've tried the following:
`$(find . iname $folder/*.txt)