I just had a sync issue (missing folder) and when i create it back and touch an new .stfolder, syncthing choose to delete all data in other synced device and not to copy them to the eroneous one.
That sayed, thanks to simple versioning, i get everything back with this home made script (i dont found the other in the forum before).
Here is mine (you need nodejs and fs-extra dependancy to use it) :
const fse = require('/usr/lib/node_modules/fs-extra');
async function main(folder){
let fileList = await fse.readdir(folder);
fileList.sort();
while(fileList.length){
let actualFile = folder+'/'+fileList.pop();
if(fse.lstatSync(actualFile).isDirectory()) main(actualFile);
let dated = actualFile.match(/^(.*)~[0-9]{8}-[0-9]{6}(.*)$/);
if(dated){
const cannonical = dated[1]+dated[2];
if(await fse.exists(cannonical)) await fse.remove(actualFile);
else await fse.move(actualFile, cannonical);
}
}
}
main('.');
after you copy back your .stversions in your synced folder, if you run my script in your sync folder it will rename and remove old copy to only keep the latest for each file, recursively for all subdirectory.
and i found (but not tested) other similar script when time to share my work have come :
- one is here : Syncthing deleted 67000 files, how do I restore?
- An other one here : forum syncthing net /t/script-for-restore-version-files/1842
Have a good restore time.