Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rename TAP files to include the name of the first CBM ROM file therein
#!/bin/bash
# Pre: make sure you have the find-rom-name binary available in your PATH
for filename in *.TAP; do
echo -n "Parsing $filename: "
cbm_name=$(find-rom-name "$filename" | grep "^FOUND:" | awk '{ print $2 }' | sed -e "s/\"//g")
if [ ! -z $cbm_name ]; then
mv "${filename}" "${filename%.*}_${cbm_name}.${filename##*.}"
echo "INFO: renamed"
else
echo "WARNING: boot name not found"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment