Any chance someone could whip up a batch file for this bad boy to use fpFLAC2FLAC.exe, somewhat like Synthetic Soul's flac-113.bat? My batch skills are pure rubbish. I have a bunch of files at flac 1.1.x and want to take all to 1.2.1.
Thanks for any help offered!
Example attached:
@ECHO OFF
CLS
REM FLAC-113.BAT Written by Neil Popham, 2007 ([email=neilpopham@bigfoot.com]neilpopham@bigfoot.com[/email])
SET batchname=FLAC-113.BAT
SET version=2.2.5
TITLE=%batchname%, Version %version%
REM ######################################################
SET pathToFLAC="C:\Apps\Encoders\FLAC\FLAC.EXE"
SET flacOptions=-8
SET retainListOfFailedFiles=1
SET retainListOfProcessedFiles=0
SET retainListOfSuccessfulFiles=0
SET flacVersion=121
REM ######################################################
REM Check whether a valid file or folder has been passed
IF NOT EXIST %1 DO GOTO NoParams
REM Set counters
SET /A noProcessed=0
SET /A noErrors=0
SET /A noEncoded=0
SET /A noSkipped=0
SET /A srcBytes=0
SET /A dstBytes=0
REM Set path to the list of failed files depending on whether it is to be kept or not
IF [%retainListOfFailedFiles%] EQU [1] (
SET pathForFails=%~dp0%
) ELSE (
SET pathForFails=%TEMP%\
)
REM Set path to the list of successful files depending on whether it is to be kept or not
IF [%retainListOfSuccessfulFiles%] EQU [1] (
SET pathForSuccess=%~dp0%
) ELSE (
SET pathForSuccess=%TEMP%\
)
REM Set path to the list of files to process depending on whether it is to be kept or not
IF [%retainListOfProcessedFiles%] EQU [1] (
SET pathForList=%~dp0%
) ELSE (
SET pathForList=%TEMP%\
)
REM Clear file used to store failed filenames
IF EXIST "%pathForFails%flac-113-failed.txt" DEL "%pathForFails%flac-113-failed.txt"
REM Clear file used to store successful filenames
IF EXIST "%pathForSuccess%flac-113-successful.txt" DEL "%pathForSuccess%flac-113-successful.txt"
REM Clear file used to store the list of files to process
IF EXIST "%pathForList%flac-113-processed.txt" DEL "%pathForList%flac-113-processed.txt"
REM Check whether the parameter is a single file or a folder
IF %~z1 EQU 0 (CALL :FolderAction %1) ELSE (CALL :FileAction %1)
REM Calculated bytes saved
SET /A dffSize=%srcSize%-%dstSize%
REM Report results
ECHO ________________________________________________________________________
ECHO.
ECHO %noProcessed% file(s) processed
IF EXIST "%~dp0FLACGETV.EXE" ECHO %noSkipped% file(s) skipped (already latest version)
ECHO %noEncoded% file(s) encoded
ECHO %noErrors% file(s) returned an error
IF %noErrors% GTR 0 CALL :ReportFiles
ECHO.
ECHO Settings used: FLAC v.%flacVersion% '%flacOptions%'
ECHO Bytes Saved: %dffSize% bytes
REM Pause
ECHO.
ECHO Press any key to exit
PAUSE >NUL
REM End
GOTO:EOF
REM ==========================================
REM FileAction : single file has been passed
REM ==========================================
:FileAction
REM Do we have a FLAC file?
IF /I [%~x1] EQU [.flac] (
CALL :Encode %1
) ELSE (
REM Do we have a TXT file?
IF /I [%~x1] EQU [.txt] (
REM Process the list of files in the file
SET pathForList="%~dp1"
CALL :ProcessList "%~nx1"
) ELSE (
GOTO NoParams
)
)
GOTO:EOF
REM =======================================
REM FolderAction : folder has been passed
REM =======================================
:FolderAction
REM Check folder and subfolders for FLAC files,call ListFiles for each file, and then Encode
ECHO Processing: "%~1"
ECHO.
REM Create temporary list of files to process
ECHO Creating list of files to process
ECHO.
FOR /R %1 %%G IN (*.flac) DO CALL :ListFiles "%%G"
CALL :ProcessList flac-113-processed.txt
GOTO:EOF
REM =============================================
REM ListFiles : Create list of files to process
REM : %1 The FLAC file to add
REM =============================================
:ListFiles
ECHO %1>>"%pathForList%flac-113-processed.txt"
GOTO:EOF
REM ============================================
REM ProcessList : Encode all files in the list
REM : %1 The text list of files
REM ============================================
:ProcessList
REM Encode each file
PUSHD %pathForList%
FOR /F "tokens=* delims=" %%H IN (%~s1) DO CALL :Encode %%H
POPD
IF [%retainListOfFailedFiles%] EQU [1] (
REM ECHO.>>"%pathForList%flac-113-processed.txt"
REM ECHO List created at %DATE% %TIME%>>"%pathForList%flac-113-processed.txt"
) ELSE (
DEL "%pathForList%flac-113-processed.txt"
)
GOTO:EOF
REM =====================================
REM Encode : Encode FLAC file
REM : %1 The FLAC file to Encode
REM =====================================
:Encode
REM Check the vendor string to see if the file is already the latest version
IF EXIST "%~dp0FLACGETV.EXE" (
ECHO Checking Vendor: "%~1"
ECHO ________________________________________________________________________
"%~dp0FLACGETV.EXE" %1
ECHO.
)
IF %ERRORLEVEL% EQU %flacVersion% (
SET /A noSkipped+=1
ECHO File is already the latest version [%flacVersion%]
) ELSE (
REM Test the original
ECHO Testing: "%~1"
ECHO ________________________________________________________________________
%pathToFLAC% -t %1
REM If an error code has been returned increase the error counter
IF ERRORLEVEL 1 (
SET /A noErrors+=1
ECHO %1 [T]>>"%pathForFails%flac-113-failed.txt"
ECHO.
ECHO File failed testing.
) ELSE (
REM Encode the file
ECHO.
ECHO Encoding: "%~1"
ECHO ________________________________________________________________________
%pathToFLAC% %flacOptions% -V -o "%~dpn1-flac-113.flac" %1
REM If an error code has been returned increase the error counter
IF ERRORLEVEL 1 (
SET /A noErrors+=1
ECHO %1 [E]>>"%pathForFails%flac-113-failed.txt"
ECHO.
ECHO File failed encoding.
IF EXIST "%~dpn1-flac-113.flac" DEL "%~dpn1-flac-113.flac"
) ELSE (
SET /A noEncoded+=1
CALL :IncreaseDestinationBytes "%~dpn1-flac-113.flac"
CALL :IncreaseSourceBytes %1
ECHO %1>>"%pathForSuccess%flac-113-successful.txt"
MOVE /Y "%~dpn1-flac-113.flac" %1
)
)
)
ECHO.
ECHO.
REM Increase file counter
SET /A noProcessed+=1
GOTO:EOF
REM ==========================================
REM ReportFiles : List the files that failed
REM ==========================================
:ReportFiles
ECHO.
ECHO Files that failed:
ECHO.
TYPE "%pathForFails%flac-113-failed.txt"
REM Delete the temporary file if not required, or add footer if keeping
IF [%retainListOfFailedFiles%] EQU [1] (
REM ECHO.>>"%pathForFails%flac-113-failed.txt"
REM ECHO List created at %DATE% %TIME%>>"%pathForFails%flac-113-failed.txt"
) ELSE (
DEL "%pathForFails%flac-113-failed.txt"
)
ECHO.
GOTO:EOF
REM =====================================================
REM NoParams : neither a file or folder has been passed
REM =====================================================
:NoParams
ECHO To run this script, please pass a valid file or folder as a parameter.
ECHO.
ECHO Press any key to exit
PAUSE >NUL
GOTO:EOF
:IncreaseSourceBytes
SET /A srcSize+=%~z1
GOTO:EOF
:IncreaseDestinationBytes
SET /A dstSize+=%~z1
GOTO:EOF
REM VERSION HISTORY
REM ===============
REM Version Date Description
REM ================================
REM 1.0.0 2007-01-07 Initial Version
REM 1.1.0 2007-01-07 Now encodes to temporary file and then moves over source
REM 1.1.1 2007-01-07 Minor formatting changes
REM 2.0.0 2007-01-07 Now works on XP (creates a temporary list of files to process)
REM 2.1.0 2007-01-09 Fixed bug with ERRORLEVEL. T(est)/E(ncode) marker added for failed files
REM 2.2.0 2007-01-09 Will skip 1.1.3 files if FlacGetV.exe is same directory as this file
REM 2.2.1 2007-01-10 Added retainListOfFailedFiles and retainListOfProcessedFiles flags
REM 2.2.2 2007-01-12 Added flacVersion
REM 2.2.3 2007-01-28 Added retainListOfSuccessfulFiles
REM 2.2.4 2007-01-28 Now accepts a text list of files as input
REM 2.2.5 2007-02-16 Fixed FlacGetV bug. Now shows bytes saved