this is the entire scripting I run to generate my lists. This script does work with filename spaces, but I also run a secondary script to take them out because mednafen emulator cannot recognize anything with spaces.
This is the exact script I run so obviously, your filepaths within the script may be different.
sudo bash renamer.sh && bash list-builder.sh
this first script renamer.sh removes all the spaces and parentheses from the filenames:
#!/bin/bash
echo ......removing spaces......
for f in /home/gamer/.cabrio/roms/gb/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/roms/gba/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/roms/gbc/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/roms/genesis/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/logos/gb/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/logos/gba/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/logos/gbc/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/logos/genesis/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/videos/gb/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/videos/gba/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/videos/gbc/*; do mv "$f" "${f// /_}"; done
for f in /home/gamer/.cabrio/videos/genesis/*; do mv "$f" "${f// /_}"; done
echo ......finished removing spaces......
echo ......removing parentheses......
for file in /home/gamer/.cabrio/roms/gb/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/roms/gba/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/roms/gbc/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/roms/genesis/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/logos/gb/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/logos/gba/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/logos/gbc/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/logos/genesis/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/videos/gb/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/videos/gba/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/videos/gbc/*; do mv "$file" "${file/_(*)/}"; done
for file in /home/gamer/.cabrio/videos/genesis/*; do mv "$file" "${file/_(*)/}"; done
echo ......finished removing parentheses......
exit
the second script list-builder.sh loops through the parent directories and then creates individual xml files for each directory (emulator/system). it then combines the individual lists into a master list and adds lines at the beginning and end to make the master list well-formed. then it removes the now unnecessary individual lists.:
#!/bin/bash
set -e
#this creates the individual game-list files according to whats in the rom directories
echo ......building game lists......
for dir in /home/gamer/.cabrio/roms/*; do
for i in $dir/*; do
dir="${dir##*/}"
i="${i##*/}"
i="${i%.*}"
echo "$i";
echo " <game>
<name>$i</name>
<platform>$dir</platform>
<rom-image>/home/gamer/.cabrio/roms/$dir/$i.zip</rom-image>
<video>/home/gamer/.cabrio/videos/$dir/$i.flv</video>