Question

I'd like to convert all WAV files in a specified folder into MP3 and store in the same directory structure, We have a several list of folders and subfolders named by date where these WAV recordings are stored.

I got up until the point thanks to related posts however unable to cross the file extension issue

for /r %i in (*) do if exist "%i.wav" do lame %i %i.mp3

I'm still learning scripting. I'm using Windows XP

Any help would be appreciated

Was it helpful?

Solution

to use this in batch file you'll need double %.

Here's one more way:

for /f "delims=" %%F in ('dir /b /s /a:-d *.wav') do (
 lame "%%F" "%%~dpnF.mp3"
) 

OTHER TIPS

Even though this is answered, I'd like to post this here to help anyone who stumbles across this post.

Here's the batch file made -- it converts m4a to mp3 (but checks for existence first, so duplicates arent created) -- keeping the original filename (whereas some answers on stackoverflow will be "songtitle.wav.mp3".

You can change the m4a extension to whatever you want.

It also deletes the old file when the conversion is done. Just remove the && del "%%A" at the end if this behavior isn't desired.

I save this as a batch file in the root directory of my music directory, and cd to the directory and run it there.

FOR /R %%A IN (*.m4a) DO (
    IF NOT EXIST "%%~dA%%~pA%%~nA.mp3" B:\Software\ffmpeg-20180716-8aa6d9a-win64-static\bin\ffmpeg.exe -threads 8 -i "%%A" -vn -ac 2 -acodec libmp3lame -q:a 2 "%%~dA%%~pA%%~nA.mp3" && del "%%A"
)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top