Files
scripts/chd_from_zip.sh
T
2020-12-18 08:35:41 +00:00

33 lines
975 B
Bash
Executable File

#!/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
sourcedir="/home/sergio/nas_roms/SNK - Neo Geo CD (2016-01-08) (Redump)"
destdir="//home/sergio/SNK - Neo Geo CD (2016-01-08) (Redump)"
#extract zip
for zipfile in "${sourcedir}"/*.zip; do
gameName="$(basename "$zipfile" .zip)"
echo -e "\e[1m\e[41mExtracting ${gameName}...\033[0m"
7z x "${zipfile}" -o"${destdir}/${gameName}-tmp"
#convet to chd
echo -e "\e[1m\e[41mConverting ${gameName}...\033[0m"
find "${destdir}/${gameName}-tmp/" -type f -iname "*.cue" -exec chdman createcd -i {} -o "${destdir}/${gameName}.chd" \;
#rm temporary directory
rm -rdf "${destdir}/${gameName}-tmp"
### uncomment below to rm the original zip archive
#rm ./"$zipfile"
echo "!!!!!!!!!!${gameName} complete..."
done
echo "All done."