How can I use favourites to find the roms and move them from main folders?
-
I am looking for a script or tool that will find all of my favourites and copy or move the roms to a destination folder. The goal is to create a collection of rom folders with only roms that have been selected as favourites. This would make it easy to take a large collection of roms, try them out, pick the ones that work, and are playable, and know that the collection is mint.
-
Assuming you're using RetroPie (and not just EmulationStation), here's a script to print the ROM files which are marked as favorites.
#!/usr/bin/env bash # Assume the gamelist is properly formatted for system in $HOME/RetroPie/roms/*; do [ ! -d "$system" ] && continue short=${system##*/} [ -f "$system/gamelist.xml" ] && { xmlstarlet sel -t -m "/gameList/game[favorite='true']" \ -o "$system/" -v "substring-after(path, './')" -o '"' -n \ "$system/gamelist.xml" continue } [ -f "$HOME/.emulationstation/gamelists/$short/gamelist.xml" ] && { xmlstarlet sel -t -m "/gameList/game[favorite='true']" \ -o "$system/" -v "substring-after(path, './')" -o '"' -n \ "$HOME/.emulationstation/gamelists/$short/gamelist.xml" } done
You can modify the script to copy the files to a different folder, though you'd have to account for the system (you can use the
$short
variable to create sub-folders at the destination folder). -
@mitu
I'm getting there:DEST=/media/MYDESTDRIV/favroms ; rm -rf "$DEST" ; mkdir "$DEST" ; cd /userdata/roms ; for d in * ; do [ -d "$d" ] && xmllint --xpath "/gameList/game[favorite='true']/path/text()" "${d}/gamelist.xml" 2>/dev/null | while read rom ; do echo "${d}/${rom}" && [ -e "${d}/${rom}" ] && mkdir -p "$(dirname "${DEST}/${d}/${rom}")" && cp -rp "${d}/${rom}" "${DEST}/${d}/${rom}" ; done ; done
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.