I am running Ubuntu. I have a folder “Project”, and in that folder I have a bunch of sub-folders. In each of the sub-folders I have either a .c file, a .jar file or a .py file. I want to iterate over all the files, and for each file, compile it, and run 5 times with different input it using the “time” command to time the execution time.
I want to create a shell script for this, but I can’t seem to find a good way to recurse over all the files in the sub-folders.
If all of the subfolders are the same depth you can use
for i in ./*/*/*/*.pywith the appropriate number of *’s. Use one loop for each format since the actions will be different anyways.