Help - Search - Members - Calendar
Full Version: Batch Convertation
Hydrogenaudio Forums > Lossless Audio Compression > Lossless / Other Codecs
Echizen
I'm going to recompress my entire lossless music collection. The music cds are in 3-4 different lossless formats; in folders and subfolders; not sorted; many with japanese chars.

I'm looking for a simple batch routine which goes over all folders. Something like this:

CODE
@ECHO OFF
FOR %%I IN (*.ape) DO mac.exe "%%~NI.ape" "%%~NI.wav" -d
FOR %%I IN (*.flac) DO flac.exe -d "%%~NI.flac" "%%~NI.wav"
DEL *.ape
DEL *.flac
(... -> i still have to think about the new format, but that doesn't matter for now)
PAUSE > NUL


Yes, I know the search function, but didn't find any suitable batch.
Synthetic Soul
It looks to me like you're pretty much there, unless you want to pipe from the old format to the new, instead of just decoding all to WAVE.

CODE
@ECHO OFF
FOR /R %%G IN (*.ape) DO MAC.EXE "%%G" "%%~dpnG.wav" -d
FOR /R %%G IN (*.flac) DO FLAC.EXE -d "%%G" -o "%%~dpnG.wav"
DEL /S *.ape
DEL /S *.flac

The inclusion of /R in the FOR command will process subdirectories, as will the inclusion of the /S in the DEL command. I would use "dpn" rather than "n" otherwise I think you'll end up with files written to system32. Not sure though.

I would also question whether source files should be deleted before the waves are checked. You could possibly do something like:

CODE
FOR /R %%G IN (*.ape) DO (MAC.EXE "%%G" "%%~dpnG.wav" -d  && DEL "%%G")

... which should only run the DEL command if the first does not return an error. Always scary though.

Another option would be:

CODE
FOR /R %%G IN (*.ape) DO (MAC.EXE "%%G" "%%~dpnG.wav" -d || ECHO "%%G">>"%~dp0failed.txt")

... which should write the filename of any failed files to "failed.txt" in the same folder as the batch file. Obviously remove the DEL commands to make this worthwhile! I think conditionally running the DEL command (previous suggestion) makes the most sense...
Echizen
Decodes from: APE, FLAC, TTA, WV | Encodes to: WV -x6 (slow)

CODE
@ECHO OFF
FOR /R %%G IN (*.ape) DO (MAC.exe "%%G" "%%~dpnG.wav" -d && DEL "%%G")
FOR /R %%G IN (*.flac) DO (flac.exe -d "%%G" && DEL "%%G")
FOR /R %%G IN (*.tta) DO (ttaenc.exe -d "%%G" -o "%%~dpnG.wav" && DEL "%%G")
FOR /R %%G IN (*.wv) DO (wvunpack.exe "%%G" && DEL "%%G")
FOR /R %%G IN (*.wav) DO (wavpack.exe -x6 "%%G" && DEL "%%G")
PAUSE > NUL


Thanks for your help. Only japanese files and folders doesn't work.

(Foobar's convert seems also very handy. You can just drag 'n drop all folders into the playlist, select all -> convert; but there is no way it deletes the input source file after the convertation.)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.