Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rename TAP files to include the name of the first CBM ROM file therein
# Pre: make sure you have the find-rom-name binary available in your PATH
# binaries available @
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"
echo "WARNING: boot name not found"

This comment has been minimized.

Copy link
Owner Author

@luigidifraia luigidifraia commented Sep 3, 2018

This script runs in a bash shell under *Nix and can be run within a Git bash shell under Windows, or similar.

Add the following line after the mv command in order to also rename the DMP file that corresponds to a TAP file being renamed:
mv "${filename%.*}.DMP" "${filename%.*}_${cbm_name}.DMP"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment