syncthing changed some modification dates - restore?

Hi,

i am syncing my android devices over a raspberry with “v1.23.2”. Version on android: “v1.23.1” from f-droid.

The android device (1) was complete with syncing to raspberry, I added a new second android device (2).

Now some pictures are changed, or at least the modification dates because of device 2.

I’m wondering why and how to undo this. Staggered file versioning is on, but the modified files are missing in the version restore options.

Are these modifications not included in the file versioning?

Can I find out why the error occurred on a few files?

This is a complex problem. Firstly, file versioning doesn’t include files with modified dates only, i.e. the content needs to differ as well. Secondly, Syncthing is unable to set modification dates on Android, so it stores them in the database instead. The problem is that if you reset/lose the database, then you lose those dates too. In such a situation, if you sync those files to yet another device, they will have the Android-modified timestamps. As far as I know, the only way to circumvent the issue is to run Syncthing on Android with root privileges.

2 Likes

The files where accurate synchronized from the first android device to the raspberry.

Then the second device was added to the folder, something may be gone wrong here with the database, on an app restart or something? The app was restarted a few times while syncing this large folder.

The file versioning is active on the raspberry side. It is a pity that this change cannot be restored now. The files are mixed up in the gallery by creation time sorting. The change is recognized in syncthing, it might be useful if these changes could also be included in the versioning as an optional feature.

Difficult to say what happened exactly but Android itself isn’t known for being stable and rock solid, so…

If you know the previous dates, there are ways to modify them manually (e.g. using various command-line tools). As for Syncthing and file versioning, the only possibility to have this functionality right now would be to write a custom versioning script and utilise it through the external versioning.

The times of the synchronized modification dates are set usually correct for the second device with lineage 13 when I look in the android filemanager. Do you mean other time data which syncthing is unable to set?

The date taken is still correct, but the last modified value is reset to the current date.

Maybe it is possible to extract the time data from exif and reset the modification date with a script, these should mostly be the same.

I’m pretty sure ExifTool can do that. At a guess, something like exiftool "-FileModifyDate<DateTimeOriginal" somefile.jpg, but try that on some test files first…

2 Likes

The best way to do this which of course only works for camera images may be:

find . -type f -name "*.jpg" -newermt "-24 hours" -exec exiftool "-FileModifyDate<DateTimeOriginal" {} +

only modify

  • jpg files (most files are camera pictures with exif data)
  • pictures which are modified in the last 24 hours or when the sync occur

In my short test it also works with files including spaces, but maybe I should create a temporary backup from the folder before execution.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.