Last active
September 5, 2020 19:29
-
-
Save luigidifraia/274d9bf7ad08b1f058ad7d6fb105e163 to your computer and use it in GitHub Desktop.
Rename TAP files to include the name of the first CBM ROM file therein
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Pre: make sure you have the find-rom-name binary available in your PATH | |
# binaries available @ https://www.luigidifraia.com/software/#Filename_extractors | |
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
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"