@Clyde said in Create script to copy and overwrite romlist files in attract mode:
Yes, this should copy all files in /home/pi/.attract/backup to /home/pi/.attract/romlists. Beware that this wouldn't copy any subdirectories in backup, for those you'd need the -R option for recursive copying:
cp -R /home/pi/.attract/backup/* /home/pi/.attract/romlists/
But if there are only files in backup the -R option isn't needed.
To make a script out of this, just put this in a text file. It is common to begin a Linux shell script with the shebang which defines the interpreter that should be used to run the script. Without the shebang, the shell will use its standard interpreter that, depending on the script, may cause problems if it handles some commands differently. RetroPie's standard interpreter is the bash, located in /bin.
Although this shouldn't be an issue with your simple script, let's give it a shebang for sheer sake of completeness:
#!/bin/bash
cp /home/pi/.attract/backup/* /home/pi/.attract/romlists/
Put this into a text file (e.g. sometextfile) and make it executable with this command:
chmod u+x sometextfile
u+x means give the file's user (i.e. owner) execute permissions.
Pro tip: If you put this file into a (new) directory /home/pi/bin, it will be found by the shell from any other directory. Otherwise you'd need to invoke it with its full or relative path. If it's in bin in the home directory of the current user, you can run it from anywhere just by its name in the command console.
As for accessing the script from the Settings section of retropie, I will have to look that up myself since I don't know that off the cuff, but I have to go to work now, so I have to put you off for later. But maybe someone else can take over this part.
Great info... I followed your steps and it works like a charm. I created file in notepadd++ - restore.romlists
#!/bin/bash
echo ""
echo "Restoring Romlists..."
echo ""
sleep 5
cp /home/pi/.attract/backup/* /home/pi/.attract/romlists/
Put the file into /home/pi/RetroPie/retropiemenu
chmod u+x the file
Added the entry in the romlist file retropie.txt (attractmode)
Created a wheel for it.. all good to go.
Thanks for the help!