LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   executing a script in multiple subdirectories (https://www.linuxquestions.org/questions/linux-newbie-8/executing-a-script-in-multiple-subdirectories-314692/)

jerryfreak 04-18-2005 07:57 PM

executing a script in multiple subdirectories
 
I have a script that processes all of the files in a given directory, I would like to automate the script to process a series of subdirectories the same way

the current script is as follows:

shn2make -k ; make ogg
This must be run from a shell in the given directory, but how do I do it from a higher directory, to run the script within each subdirectory?

TIA,
jamie

bigrigdriver 04-19-2005 08:34 PM

Enclose it in a for-next type loop. Include the command to 'cd <higher directory>', then,
for each <subdirectory> in <higher directory>,
do
cd $subdirectory
do 'whatever you want it to do',
done.

I hope you realize this is quasi-psuedo code. But it should convey the general idea of my suggestion.


All times are GMT -5. The time now is 11:27 AM.