33 lines
775 B
Bash
Executable File
33 lines
775 B
Bash
Executable File
#!/bin/bash
|
|
|
|
## Place this script into root folder that contains .7z 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"
|
|
|
|
## Delete temporary directory
|
|
rm -R ./"${gameName}-tmp"
|
|
|
|
## Delete original 7z archive
|
|
if [ -f ./"${gameName}.chd" ]; then
|
|
rm ./"$x7zFile"
|
|
echo ">> ${gameName} complete"
|
|
else
|
|
echo ">> ${gameName} failed"
|
|
fi
|
|
|
|
done
|
|
|
|
echo "All done."
|