Code share : Syncthing-Restore for .stversions folder

Hi everybody,

After a little mistake on a folder name, with huge amount of files deleted/replaced on a lot of computers (but placed on .stversions - staggered file versioning) I realized that it will be impossible for me to manually put back all the files with the correct names (19300 files).

As it’s not the first time and not the last I need to do that kind of thing, I checked https://docs.syncthing.net/users/contrib.html before, and then written a simple but complete tool to perform the “restore” operation on my Windows and Linux computers.

It takes care not to overwrite without permissions and it detects conflicts (several versions matching the restore dates about to be restored in the same destination) before doing anything. In case of any failure on some files operation, those files simply don’t move and a message is telling what file didn’t worked.

Hope this will help ! I added the logo and some care to the visual (layouts, so compatibility with zoom factors on high DPI screens, clean code and comment in english…) in order to share it in a most decent presentation.

Bye !

4 Likes

I believe I’m not the only one who had to deal with the .stversions files restorations in the past, if someone already done something else, feel free to share or to take things/ideas/functions into my code if you want.

If someone has to take the code but there is a problem with the License or anything else I should change or do, do not hesitate to tell me !

At almost the exact same time @AudriusButkevicius posted a PR with a restoration GUI for Syncthing’s “internal web GUI”. I don’t know whether your use cases/approaches are the same or complement each other, but it may be a good idea to contact @Martchus and @sieren which both have a QT wrapper for Syncthing - maybe your restoration tool can be included.

Thank you for your message

Great news that this feature is now going to be included into the WebUI ! If there is something done by one of the maintainers who know very well the source code of Syncthing, to be integrated inside of the current Syncthing WebUI, then it’s always better.

After all, my few hours spent on the little soft already turned profitable to me as on saturday, repairing my mistake on my 4 synchronised computers would have been infeasible by hand (19300 files on remote computers with limited bandwidth so I restored it on each one)

Bye

I also see the need for this feature. The only reason I haven’t cared much about it is the fact, that I have actually never had to restore older versions except a few files (seems like I’m lucky).

Since this will be integrated into Syncthing itself, it is likely not very useful to have the code duplicated in my Qt wrapper. Otherwise I actually would have included this.

Let’s see whether it is worth making the feature accessible from the tray. Likely not so much as it is (hopefully) only rarely used.

too bad it’s windows only! :pensive:

in case anyone else stumbles in here, looking for a more generic script, i hope we’ll soon have one:

https://forum.syncthing.net/t/script-to-restore-all-staggered-files/16535/2