Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
for f in ./*.mp3; do sox "$f" "${f%%.mp3}processed.mp3" silence 1 0.02 1% -1 0.02 1%; done


This is a script I'm using to process audio files. The problem is that it keeps going in a loop, processing the new audio files as well. I'd like to fix this by having the output go in a subfolder, so I tried this:

for f in ./*.mp3; do sox "$f" "/subfolder${f%%.mp3}processed.mp3" silence 1 0.02 1% -1 0.02 1%; done


This is the output:

/subfolder./01processed.mp3


This is giving me an error with SoX, I need to remove the ./ before the filename output, how might I do that? This is the output I'd like to have:

/subfolder/01processed.mp3


What I have tried:

I tried indicating a subfolder, but I can't seem to remove the leading ./ from the filename, and that's making SoX crash.
Posted
Comments
Richard MacCutchan 23-Jul-16 8:42am    
Why not leave off the ./ from the start, and code just:
for f in *.mp3; ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900