Found this code (https://github.com/Topslakr/x32Live-CleanUp/blob/master/Delete_Silent) and it works great in Cygwin for what I need, but, I'd like to have it also run in all subdirectories. Been searching, trying all kinds of things but nothing works. Not a linux person, btw.
I know it is this first line that needs to change:
for wav in *.wav
do
V=$($sox "$wav" -n stat 2>&1 | grep "Maximum amplitude" | cut -d ":" -f 2 | sed 's/ //g')
if [[ $(echo "if ("$V" > "$MAX") 1 else 0" | bc) -eq 0 ]]
then
if [ $safe = 0 ]
then
echo "Deleting Data"
rm -rfv "$wav"
else
echo "Running in Safe Mode"
echo "Would delete $wav";
fi
else echo "File $wav not slient"
fi
done
I do have it working in specific levels of subdirectories by changing the line to:
for wav in */*/*.wav
But I have varying levels of subdirectories and it would be great if I could run one code instead of several for each respective level of subdirectory. Anyone know what the solution is? (Thank you!)
To get the wav files for every sub-directory, you would use:
for wav in **/*.wavRead more here: What does ** mean in a path?