I have got over 1000 folders, and each folder contains one .wav file and one .txt file (example of the folders). The text file contains the time interval, and I need to trim the .wav file into clips based on the time interval that each text file given (note that text files are in different folders). I have got the following script from enter link description here
#!/bin/bash
index=0
while read this; do
if [ $index -gt 0 ]; then
sox sound.wav clip-$index.wav trim $start $this-$start
fi
((index+=1))
start=$this
done < times.txt
However, it is for single file and it can only be used for files in current directory. How can I make it work for subfolders and into a loop?