Skip to content

Instantly share code, notes, and snippets.

@superjamie
Created December 17, 2023 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superjamie/e422469287189342db31312e2d70c5fd to your computer and use it in GitHub Desktop.
Save superjamie/e422469287189342db31312e2d70c5fd to your computer and use it in GitHub Desktop.
iso2chd - Bash script to convert ISO to CHD
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 ISO|CUE"
echo " Converts input file to same-name CHD"
exit
fi
if ! [ -x "$(which chdman)" ]; then
echo "ERROR: Need chdman. Install mame-tools."
exit
fi
if ! [ -f "$1" ]; then
echo "ERROR: Input file \"$1\" does not exist"
exit
fi
INPUT="$1"
#echo "DEBUG: Input = \"$INPUT\""
TARGET="${INPUT%.*}.chd"
#echo "DEBUG: Target = \"$TARGET\""
if [ -f "$TARGET" ]; then
echo "ERROR: Output file \"$TARGET\" already exists"
exit
fi
chdman createcd -i "$INPUT" -o "$TARGET"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment