RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    [Script] One-liner to backup or disable the gamelists in all rom directories

    Scheduled Pinned Locked Moved Projects and Themes
    gamelistgamelist.xmlbackupscripthow-to
    1 Posts 1 Posters 667 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ClydeC
      Clyde
      last edited by Clyde

      Hi!

      I just wrote this for myself to "disable" all of the gamelists in all of my rom directories to test new gamelists in ~/.emulationstation/gamelists, since Emulation Station seems to prefer the former if both are present. Then I thought, sharing is caring. :)

      Disable all gamelists by adding .disabled to their names:

      for i in ~/RetroPie/roms/*/; do mv -v "$i/gamelist.xml" "$i/gamelist.xml.disabled"; done
      

      Enabling them again:

      for i in ~/RetroPie/roms/*/; do mv -v "$i/gamelist.xml.disabled" "$i/gamelist.xml"; done
      

      These lines have to be executed in Retropie's console that you land in by pressing F4 in Emulation station. The command exit will get you back to ES.

      This variant would be a simple backup. It copies the files instead of renaming them.

      for i in ~/RetroPie/roms/*/; do cp -v "$i/gamelist.xml" "$i/gamelist.xml.backup"; done
      

      Restore:

      for i in ~/RetroPie/roms/*/; do cp -v "$i/gamelist.xml.backup" "$i/gamelist.xml"; done
      

      But be careful, cp will overwrite any existing files (e.g. an existing gamelist.xml or gamelist.xml.backup) without warning or query.

      Comments:

      • Change ~/RetroPie/roms/*/ to ~/.emulationstation/gamelists/*/ to use it on the gamelists in that location.
      • If you put these lines into text files inside a directory bin in your pi user's home directory (i.e. /home/pi/bin) and make them executable by the command chmod u+x ~/bin/filename, you can run them just by their names from anywhere in the directory tree.

      edit: Changed the chmod command to ~/bin/filename for (maybe) better understanding. :)

      1 Reply Last reply Reply Quote 2
      • First post
        Last post

      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.