#!/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."