Linux - script to batch convert PSX bin/cue to CHD
-
Hello forum,
Searching and finding questions but not answers for linux users, I wrote a bash script today to:
-
extract PSX bin/cue (Including multi bin games) from their 7z archive into temporary folder
-
process them into CHD files then cleanup extracted files and optionally the original archive
Each 7z is done in sequence and will be particularly useful to those with limited spare disk space... or just want it tidy when its finished
This was used on Ubuntu 20.04, Debian will be fine also.I wanted somewhere to share this if its helpful to anyone else, that said here is the code:
#!/bin/bash ###place this script into root folder that contains .7z PSX archives ###may need to chmod +x file to make executable ###uncomment below if required software not on system #sudo apt-get install -y mame-tools p7zip-full #extract 7z for x7zFile in *.7z; do gameName="$(basename "$x7zFile" .7z)" echo "!!!!!!!!!!Extracting ${gameName}..." 7z x "${x7zFile}" -o./"${gameName}-tmp" #convet to chd echo "!!!!!!!!!!Converting ${gameName}..." chdman createcd -i "./${gameName}-tmp/${gameName}cue" -o ./"${gameName}.chd" #rm temporary directory rm -R ./"${gameName}-tmp" ### uncomment below to rm the original 7z archive # rm ./"$x7zFile" echo "!!!!!!!!!!${gameName} complete..." done echo "All done."
-
-
Just the script I was looking for. :) You might want to expand it to extract ecm-compressed files that seem to be rather common in downloaded
7z
files for the PSX in my experience. See https://retropie.org.uk/docs/Playstation-1/#ecm-compression for more information about how to extract them. -
Just as an supplement to your all-in-one solution for anyone needing just that: A one-liner to batch-convert all
.cue
files into CHDs in the current directory.for i in *.cue; do chdman createcd -i "$i" -o "${i%.*}.chd"; done
edit: removed one
%
from"${i%%.*}.chd
to cut only the last extension for compatibility with file names with mutltiple dots. -
@Clyde said in Linux - script to batch convert PSX bin/cue to CHD:
You might want to expand it to extract ecm-compressed files
I'll drop just another one-liner here that decompresses all
.ecm
files in the current directory:for i in *.ecm; do ecm-uncompress "${i}"; done
Please note that you might need to install the ecm tools first via the command
sudo apt install ecm
. -
Hi!
The original script doesn't work: it's impossible that it works as-is, because it's missing a dot on the line where chdman is called.
So, instead of this:
chdman createcd -i "./${gameName}-tmp/${gameName}cue" -o ./"${gameName}.chd"
It should read like this:
chdman createcd -i "./${gameName}-tmp/${gameName}.cue" -o ./"${gameName}.chd"
I hope the OP can correct the original script ;)
-
-
@sleve_mcdichael You made my day. š
@vanfanel Thanks for the correction anyway! šļø
-
-
@sleve_mcdichael Patience is a virtue.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.