29 Jan 2019, 13:53

Hey there,

when making backups of my old Playstation-CDs, some ended to have multiple bins. As I did not want to click my fingers sore, I looked for a solution to batch process them.

I found a solution, that uses MAME's chdman.exe to convert the multi-bin to a chd Image, first, and then the chd to a single-bin. Might not be the most elegant way - but it works.

First you need chdman.exe, then paste the script below in your favorite text editor, change it as required, save it as cmd- or bat-file. Run it and watch it do the work for you.

Have fun!

@REM Multi-BIN Batch conversion script for chdman
@REM 2019-01-29 by The_Mole for forum.recalbox.com

@REM Requires chdman.exe in the image-sourcepath


@REM Switch off unneccessary output
@ECHO off 
REM Clear the screen
CLS  
REM Let's SET the different folders
REM Here you SET the source path, where your multi-bin CD-images are. Subdirectories are supported.
SET sourcepath="X:\PSX_Multibin_Images"
REM Here you SET a path for the intermediate chd file. %TEMP refers to the Windows standard Temp-Folder.
REM If you convert a larger batch you may want to conserve writes on your system-SSD and use a ramdisk or HDD, instead.
SET workpath=%TEMP%
REM Here you SET your output directory, where you want your single-bin CD-images to be stored.
REM If you SET it to your source path, your cue-files will be overwritten.
SET destpath="X:\PSX_Converted_Images"
REM This is a safety catch to make sure, you edit the file, before running it.
REM Put a rem-command before the line below to unlock the script.
GOTO idiotfilter
REM Here we start the loop: For every cue-file in %sourcepath% and its subdirectories execute the commands inside the bracket
FOR /R "%sourcepath%" %%R IN (*.cue) DO ( 
REM Print an empty line 
ECHO. 
REM Print a status message. %%~nR refers to the filename of the cue-file WITHOUT extension
ECHO ### Converting %%~nR to chd ###
REM Create the chd-Image. %%R refers to the cue-file WITH extension,
%sourcepath%\chdman.exe createcd -i "%%R" -o "%workpath%\%%~nR.chd" -f 
REM Print an empty line 
ECHO. 
REM Print a status message. %%~nR refers to the filename of the cue-file WITHOUT extension
ECHO ### Converting chd to %%~nR.bin ###
REM Create the single-bin image, including a cue-file, overwrite existing files.
%sourcepath%\chdman.exe extractcd -i "%workpath%\%%~nR.chd" -o "%destpath%\%%~nR.cue" -ob "%destpath%\%%~nR.bin" -f
REM Delete the chd-file. We no longer need it and it's always good to clean up after yourself.
DEL "%workpath%\%%~nR.chd"
REM Print an empty line 
ECHO. 
@REM Print an empty line 
ECHO. 
REM Close the loop. Start the next or move on if there are no files left.
)
REM This is a jump mark. If you read all comment lines, you know, why it's here.
:idiotfilter
REM Well... what it says.
EXIT

PS: According to the preview, the code block seems not to recognize it as batch-script, so it may look a bit starnge.