I'm trying to convert 728 .raw files to 16khz .wav files but I'm receiving the following error

sox FAIL formats: can't open input file `outputdir/rawfile/b95981d1-3aa6-4d10-b755-990915951efc': No such file or directory

script I'm using is


mkdir -p "outputdir"
for i in rawfile/*.raw; do 
    sox "$i" -r 16000 -e signed ${o%.raw} ${o%.wav}

the script is in convert.sh and the raw files are in rawfiles folder. The file structure is like




I have 728 files to convert .raw files to 16 bit 16khz mono wav files. What modifications do I have to do in order to remove the error and convert the files?


The error message says "can't open input file xxx: No such file", so the first step is to go look at file xxx and see if it actually exists, what permissions it has etc.

If I had to guess: The filename contains spaces, and you only got the first part of the filename. Solution: Use quotes in the script.

But there can be other reasons why it doesn't work, and the way to find out is to inspect the file. The error message is there for a reason. :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.