Skip to content

Instantly share code, notes, and snippets.

@jmacego
Created March 16, 2020 01:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmacego/51af7c731210ccb0fc32e89674559e34 to your computer and use it in GitHub Desktop.
Save jmacego/51af7c731210ccb0fc32e89674559e34 to your computer and use it in GitHub Desktop.
rom folder to playlist - RetroPie PSX
#!/bin/bash
# Take a folder with a structure like:
# File (Disc 1).bin
# File (Disc 1).cue
# File (Disc 2).bin
# File (Disc 2).cue
# ...
# and rename the .cue files to .CD# and then create a .m3u
# suitable to RetroPie
for i in *.cue; do
newfile=$(echo $i | sed -e 's/\(.\)..cue/\1\).CD\1/');
echo "$newfile"; mv "$i" "$newfile";
playlist=$(echo $i | sed -e 's/\s*[(]Disc.*/.m3u/');
echo $playlist; echo "$newfile" >> "$playlist";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment