Recreate synced folders after data loss

I copy all my household’s android devices’ backups via syncthing to my external HDD.

My backup HDD died, so I need to recreate the folders.

I’m getting messages for each folder such as:

Stopping folder "Ravidroid Internal" (ravidroid-internal) - folder marker missing

I really don’t want to remove and re-add numerous folders so that the .stfolder is recreated.

In Recreate missing folder marker and rebuild folder content (raised by someone else), the issue/feature request was directed to the forum. I don’t believe it was raised here, so I’m doing it.

I have my the config, but have lost the sync directories and their .stfolders.

Is there a way to safely recreate the folders:

  • without the tedium of removing and re-adding the configuration for each folder
  • telling syncthing not to propagate the empty folder to the other devices
2 Likes

If this affected all folders on the affected device the safe way forward is syncthing -reset-database. This will make it resync from a blank slate.

If it is only a subset of folders you need to manually remove and recreate them in the GUI, to clear out the index data for them.

1 Like

So -reset-database only has one -?

It wasn’t all directories.

If I rename the ones I want to keep, then run this command, can I put back the copies I kept afterwards?

Or is the database stored outside of the folders being synced?

Yes that’s just one - for long flags, that’s a Go thing.

Database is outside, you don’t need to rename anything. The downside of -reset-database is that all folders will need to be rescanned fully. This is just resource intensive, but won’t do any “harm”. Recreating the folder is maybe less convenient, but won’t need a full rescan of all other folders.

Thanks guys.

For others, I:

  1. Stopped the service
  2. syncthing -reset-database
  3. Started the service

This even created the missing .stfolders for me.

1 Like

Would someone with access consider linking this page from the GitHub issue?

It’s locked to contributors only.

Thanks @AudriusButkevicius for doing that.

Future googlers: the potentially behaviour of creating .stfolders may change in future, see:

Hi folks, I’ve got this same issue, but on Android. Is there a command line or some other equivilent for that platform?

Nevermind, I’ve removed the shares and re-shared and re-enabled, etc. Data was preserved and files were re-created.

On an Android it helps to create .stfolder and restart syncthing with appropriate button in app.