Clearing the lastplayed and playcount from gamelist.xml's
-
got this error:
-bash: ./clearlastplayed.sh: /bin/sh^M: bad interpreter: No such file or directory
I placed the clearlastplayed.sh file in roms directory, if this is relevant.
-
@papinist That's because of the DOS newline in the file. Run the following command on over the command line, from the same folder where you have the script
sed -i 's/\r//' clearlastplayed.sh
then try running the command again.
-
It worked like a charm! Thank you @mitu for the help :)
-
@papinist @tanstaafl is the real help here. I'm just browsing.
-
Hey thanks for the script, really appreciate it. I added some stuff, that I‘d also liked to flush for a clean start, Wifi-credentials for example. And I also added a chmod 777 for the gamelist folder afterwards, because the rebuild xmls lacked writing permission.
Still i couldn‘t accomplish to also remove my favorites by adding „-e favorites“ to the grep line. All xmls that had favorites get screwed up, I can‘t see any metadata for the systems games afterwards.
I‘m on my way to work now, so I can‘t provide you with any more information. But perhaps someone has already dealt with this issue?
I‘d also like to remove all registered bluetooth devices with this script. To have just my roms and gamelists left to carry over to another setup. But I couldn‘t find a config file to edit or remove. Ideas?
-
Thanks for the script. I would add a +1 as a feature. After setup and testing I have the first game in each emulator in my list which would be nice to flush before imaging.
-
Very thanks.
I contribute with a grain of sand, in Spanish, but it is easy to edit, it is a menu with dialog to clean lastplayed and playcount, 3 options:
1 "home/pi/RetroPie/roms"
2 "opt/retropie/configs"
3 "both 1 and 2"
4 "Exit" 2>"${INPUT}"
The code, copy paste and give execution permission:
https://pastebin.com/tGPMehXr -
Hi all,
I've tried this usefull script but it doesn't work for me.
I put it in /home/pi/Retropie/roms folder. Make it executable. Than launch it typing ./name_of_The_script.sh and it says:file: /home/pi/RetroPie/roms//gamelist.xml'
./clear_played.sh: 7: ./clear_played.sh: cannot create /home/pi/RetroPie/roms//gamelist.xml.tmp : Directory nonexistent
mv: cannont stat '/home/pi/RetroPie/roms/**/gamelist.xml.tmp' : No such file or directoryWhat's the mistake?
-
@davidgrohl The script fragment expects the
gamelist.xml
located in the ROMs folders, but by default they're in/home/pi/.emulationstation/gamelists/<system_name>
. Try the script posted by @kactius, it allows you to select one of the 2 locations for the gamelist.xml files. -
@mitu said in Clearing the lastplayed and playcount from gamelist.xml's:
@davidgrohl The script fragment expects the
gamelist.xml
located in the ROMs folders, but by default they're in/home/pi/.emulationstation/gamelists/<system_name>
. Try the script posted by @kactius, it allows you to select one of the 2 locations for the gamelist.xml files.Thanks @mitu for reply. That scripts works with option 2.
Great! Thanks a lot. -
@mitu said in Clearing the lastplayed and playcount from gamelist.xml's:
@davidgrohl The script fragment expects the
gamelist.xml
located in the ROMs folders, but by default they're in/home/pi/.emulationstation/gamelists/<system_name>
. Try the script posted by @kactius, it allows you to select one of the 2 locations for the gamelist.xml files.Hi guys.
I'm trying to clear my last played games list, but it doesn't work :(
I've created cleanlastplayed.sh file with this code:
#!/bin/sh
#clear_played.shfor f in /home/pi/RetroPie/roms/**/gamelist.xml
do
echo "file: $f"
grep -e lastplayed -e playcount -v $f > "$f.tmp"
mv -f "$f.tmp" $f
doneIt's ok? Or I've to modify it with the name of the system name (**)?
And where should I put this file? What directory?
Thanks
-
You should use a single wildcard (
*
) instead of the system name, but the script will only find thegamelist.xml
files from the ROM folders, you might have some gamelist files in~/.emulationstation/gamelists/<system>
folders. -
@mitu said in Clearing the lastplayed and playcount from gamelist.xml's:
You should use a single wildcard (
*
) instead of the system name, but the script will only find thegamelist.xml
files from the ROM folders, you might have some gamelist files in~/.emulationstation/gamelists/<system>
folders.Ok, i will try with only one windcard.
But where i've to put my cleanlastplayed.sh file?
-
@Invisible89 said in Clearing the lastplayed and playcount from gamelist.xml's:
But where i've to put my cleanlastplayed.sh file?
It doesn't matter, as long as you execute it correctly. Let's say you save it in
/home/pi/RetroPie/scripts
.#make the folder mkdir -p $HOME/RetroPie/scripts # create the file in $HOME/RetroPie/scripts/lastplayed.sh # run the script bash $HOME/$HOME/RetroPie/scripts/lastplayed.sh
-
@Invisible89 said in Clearing the lastplayed and playcount from gamelist.xml's:
@mitu said in Clearing the lastplayed and playcount from gamelist.xml's:
You should use a single wildcard (
*
) instead of the system name, but the script will only find thegamelist.xml
files from the ROM folders, you might have some gamelist files in~/.emulationstation/gamelists/<system>
folders.Ok, i will try with only one windcard.
But where i've to put my cleanlastplayed.sh file?
Ok, i understand.
Thanks
-
@mitu said in Clearing the lastplayed and playcount from gamelist.xml's:
@Invisible89 said in Clearing the lastplayed and playcount from gamelist.xml's:
But where i've to put my cleanlastplayed.sh file?
It doesn't matter, as long as you execute it correctly. Let's say you save it in
/home/pi/RetroPie/scripts
.#make the folder mkdir -p $HOME/RetroPie/scripts # create the file in $HOME/RetroPie/scripts/lastplayed.sh # run the script bash $HOME/$HOME/RetroPie/scripts/lastplayed.sh
Ok, now I've this when I try to run the script:
pi@retropie:~/RetroPie/scripts $ ./delete_pla_last.sh
-bash: ./delete_pla_last.sh: Permission deniedWhat I've to do to take a permission?
Thanks
-
@Invisible89 said in Clearing the lastplayed and playcount from gamelist.xml's:
What I've to do to take a permission?
It's because you've not made the script executable - that's why in my example command I've run it through
bash
. Just runchmod +x delete_pla_last.sh
and re-run the script.
-
@mitu said in Clearing the lastplayed and playcount from gamelist.xml's:
@Invisible89 said in Clearing the lastplayed and playcount from gamelist.xml's:
What I've to do to take a permission?
It's because you've not made the script executable - that's why in my example command I've run it through
bash
. Just runchmod +x delete_pla_last.sh
and re-run the script.
Finally! ;)
Done, thank you man!
-
Hello, thanks for this script.
Unfortunately, when I attempt to run it, I receive the following message:
"
Clearlastplayed.sh, : 3:, clearlastplayed.sh, : syntax error: redirection unexpected
"Anyone know what this means?
Cheers.
-
@RetrOkada Okay, so all sorted now. To run the script, I was entering sh "clearlastplayed.sh". I tried ./clearlastplayed.sh instead, and it worked perfectly.
I also removed the DOS line breaks from the script, so circumvented the "Bad Interpreter" issue.
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.