Savestate and savefile oncloud//Nextcloud syncronization
I use 3 Retropie machines in different rooms and situations (one Pi on the living room, another on my "home-office", and the laptop when my wife is watching some Tv on the living room) so i have a big problem with the savegames on the different machines.
I have a small server with some services and one of them is nextcloud so, i decided to put a bit of effort to synchronise the savegames over the nextcloud.
So, after some testing i ended up with a script that:
1.- If owncloudCMD is not on the system, it compiles the owncloud-client.
2.- changes the savefile and savestate location to all the cores(If you use the roms directory it will take a long time to sync, even if you exclude everything except the savefiles, the owncloudcmd will check all the files and then determine if is excluded or not and that is a lot of time with 5-6 systems and 500-1000 roms per system)
3.-It will create a runcommand-onend and runcommand-onstart, to sync the saves just before and after a game session, so your saves will be allways up to date.
4.- It will configure a total sync on boot in the /etc/rc.local
The script saves your owncloud username and pasword on plain text on a file located at $HOME/.savesync/saveconfig so i encourage you to use a separated account for the rom sync.
Also the root folder you choose on your nextcloud, MUST be created.
To use the script:
git clone https://github.com/recioalex/savesync.git cd savesync ./configuresavesync -u username -p password -l /home/pi/RetroPie/saves -o https://my.owncloud.nextcloud.server/remote.php/webdav/Retropie/saves **** on the Ownlocud server Retropie/saves MUST BE CREATED ****
If you have improvements for the scrip make a pull request on github
This script could be improved to use other cloud solutions, so if someone have interest there is a nice base.
For easy testing, it cold be done only modifying the runcommand to use the synchronisation client of the other cloud solution instead of owncloudcmd.
backstander last edited by
I mean NextCloud
Edited first post to correct typos from nexcloud to nextcloud.
Relik last edited by Relik
A couple of quick questions if you do not mind:
I created the /home/pi/RetroPie/Saves folder and ran the script. It set up nextcloud and it creates a directory for every system (nes/snes/etc.). I have the /all retroarch.cfg file configured to target the /home/pi/RetroPie/Saves folder for all saves and save states, however games would not save here. I noticed that the folders were owned by 'root' - so I changed that to pi:pi ... I could then see games being saved etc. Should I be modifying the owner here on these folders and do I just place all saves into each respective directory?
When you reference /Retropie/saves at the end of your webdav address for Nextcloud - is that just the nextcloud userid/rootfolder? Say I had a user named Retro and a folder named Saves ... would my addess end in /Retro/Saves?
I can't seem to get it to sync any files up to the server or pull any down for some reason.
This is on a fresh install of Retropie. I should note too that my Nextcloud server is running version 9.0.53 I believe, so I don't know if that is an issue if the fresh install is breaking trying to communicate with an older version on the server?
Mmmm, in a clean install i didn't change any permissions... anyway, run a:
sudo chown pi <yourSavesDirectory> -R
And all your save game sub directories will become properties of PI.
I will look at the code to make it change the directory permissions.
The address on the nexcloud is
So is directory Retropie, sub directory saves.
Your address must be
if you want your saves directory on the root of the owncloud user directory
I have more things on this retropie nextcloud user, so i have a separated directory for the saves inside the Retropie directory.!
If you look at the comands of the script you can sync for example your romsets whit 1 or 2 commands... very handy...
The directory /Retropie/saves on the nextcloud MUST BE CREATED MANUALLY! the rest of directories not, but saves must exist or owncloudcmd will fail to sync with a non existent destination.
Sorry for the late response... i don't look too much at this forum...
The script is tested with nextcloud 11.0.1
Relik last edited by
Thank you very much for the reply! I will test this soon. Thanks again!
zerojay last edited by
For anyone wanting to attempt this with Stretch, it's actually a lot easier. The owncloud client and command line client are now included in Stretch. Run apt-get install owncloud-client-cmd to install the client this script needs. Then edit the script so that it is checking for owncloudcmd in /usr/bin/owncloudcmd instead of /usr/local/bin/owncloudcmd. Run the edited script through sudo and away you go. Everything works swimmingly aside from the fact that old saves are not moved to the new location.