#!/bin/bash # remove all whitespace and replace with underscores find /home/pi/RetroPie/roms/amiga/*/ -type f -name "* *" -exec bash -c 'mv "$0" "${0// /_}"' {} \; wait # add all games to a list, add the bare configuration file to all directories then add file path to list for d in /home/pi/RetroPie/roms/amiga/games/*/ do (cd "$d" && ls > gamelist.txt && cp /home/pi/RetroPie/roms/amiga/scripts/config.uae "$d" && awk -i inplace 'BEGIN{"pwd"|getline d} {print d "/" $0}' gamelist.txt && cp /home/pi/RetroPie/roms/amiga/scripts/amiberry.pl "$d" && cd "$d" && perl amiberry.pl) done wait #remove additional files in game folders sh cleanup.sh