-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync file creation timestamps #9191
Comments
What are you using to sync to the iPhone? Syncthing is not available there. And are you talking about creation date or modification date? Better to discuss this on the forum, as long as a bug is not clearly identified. |
I am using Mobius sync to sync. I am not sure whether it is due to Mobius sync as it might be caused by the sync from macOS syncthing? |
The iPhone screenshot only shows one time with no further information. Are you sure that it's supposed to be creation time and not modification time? Usually, when a file explorer only shows one time, it's modification time. |
You will have to take this up with the Möbius Sync people. It's not our product and Syncthing earns nothing from their commercial offering. Thus free support for a commercial software is very limited. |
Ok. I have posted the same at Mobius. By the way, is there a way to use syncthing direct in iOS platform? |
The iOS/Mobius stuff is a red herring; Syncthing doesn't sync creation dates on any platform. Those aren't part of the usual file system APIs and many file systems don't have them to begin with. Nonetheless we could investigate what it would take to do so. |
I think this issue may not be strictly about syncing creation time. For example, on Windows, even if I update a file on another device and let Syncthing sync the changes to the current device, the file still retains its original creation time after the update. Here, however, it seems that the creation time gets reset on update. |
I don't know what you're seeing, but the behaviour described here makes sense as every synced file is created from scratch. It's just that not that many people look at or care about creation timestamps. |
Normally, at least on Windows (and on macOS too, judging by the first screenshot from this very issue), the original creation time gets retained even when files get updated (either locally or through Syncthing). |
Syncthing doesn't "update" files, except in the limited circumstance of just changing permissions or other metadata. If the content has changed it's a new file. |
But "updated" is specifically the term Syncthing itself uses! In the GUI, it's either "updated" or "deleted", never "created" (related issue: #7283). Nevertheless, the point is that the original creation date is normally retained even when modifying the file on another device and syncing those modification to the current device, e.g. |
I can pretty much guarantee that it isn't. |
It is on Windows for sure. Of course, this may be due to how the OS deals with file replacement, not necessarily thanks to Syncthing itself. On the other hand, Android doesn't seem to even support creation time at all. I can't check other OSs right now. |
When the file first created, it should retain the state of the file regardless of which OS platform. That is why there is an attribute like Creation Date. When sync happen, if the file content differs, it should retain the original state of file creation date & time, however the content differ, sync should update only modify date & time. It's the same behavior in other platform like iCloud, OneDrive etc. |
Related: https://forum.syncthing.net/t/feature-request-sync-creation-times-dates/9184 @kennygokh Can you test what happens the other way around? Basically, just modify the file on the iOS side and see what happens with the creation and modification dates on the Mac. |
On Windows it just retains the creation date of when the file is being created on that Windows machine, it still doesn't retain any 'original' creation date from the sending side. But even so, Windows seems to be a special case as MacOS and Linux never retain that creation date. And indeed, Android with its emulated FS is another special case. There does seem to be some support for it since API 26, but it doesn't seem to result in much. |
I am not able to try as I get insufficient disk space error. The same error (see screenshot) encountered even though I created a test vault with a small file. |
This is also an issue on linux. Some filesystems like btrfs have birthtime, but syncthing doesn't seem to set it on synced files. |
I don't think there's even an API to set that timestamp. It cannot be synced. |
OpenWRT 23.05 doesn't appear to support birthdates in a default install:
|
Just wanna say as a Windows user, I really need this feature. Windows Explorer enables sorting by folder/file creation time by default, which is so necessary for me to find my documents. So, strongly hoping to this :-) A temporary solution may be (before this function is implemented), we can use some kind of programming to synchronize the file creation time during the initial synchronization, and then keep syncthing turned on, and it will continue to synchronize new additions files (perhaps with a slight time offset). |
To clear some things up for everyone: The Creation timestamp does not "belong" to the file. It belongs to the filesystem (partition, disk) that contains it. Some filesystems don't even store this at all, so it's not a universal idea. While the modification time should follow the file around, the creation time does not (and it shouldn't, this isn't what it's meant for). Even in Windows that we are used to rely on Creation Time, it's not guaranteed to be preserved. For example, if you copy a file you made yesterday, you will notice that the copy has a creation time of NOW even if it says modified yesterday. If you then delete the original and keep the copy, it would be almost equivalent as if you moved it, but the original creation time is lost, it is a newly created file after all. If you move the file around in the same partition (say you make a subfolder and put it in), it's preserved. If you move the file to a USB disk, you will again see that the creation time is lost and changed to now. That is correct, the file was JUST NOW created on the USB stick, even if it was modified on some other disk earlier. To re-iterate, the creation timestamp is the storage medium telling you when it saw that file for the first time, not when you first made it. Those 2 just happen to initially coincide when you make a new file from scratch. So, when you copy or backup files, the creation time is always "new" for the copy, if it even exists at all, as some don't store that value. Modification times should always be preserved and when they are not that is wrong and shouldn't happen, but not so for creation times. Lastly, as some of you noticed and in some cases, updating a file can also update its creation time to now, along with its modification time. That happens because certain apps don't edit the original file when they have to update it but instead save a whole new file to replace the old one. This is either done unnecessarily, out of weirdness, or for safety reasons. In the later case the new file is initially saved with a new filename, then the old one deleted and the new one renamed to take its place. This saves your file in case the operation is interrupted as the original is still untouched until the new one is safely stored. This is very common behaviour for backup/sync software so that you don't end up with only half-transfered files and no originals and lose your data. In conclusion, Creation time is useful, but only to an extent, don't count on it. If you need to know when a file was created, put that in the filename. In the case of the original poster, I'm not sure the iPhone even stores creation times at all. On the contrary, its storage system for user files is so unorthodox, it may often lose the modification time as well when it receives files and apply the current time instead, with a lot fewer options to avoid that than we have on other systems. As in, every file you put on an iPhone is "modified" when you put it on the iPhone, even if YOU didn't changed it, the iPhone did. It wasn't there before, now it is, that's a modification 🤦♀️ This of course varies from app to app, but still it is seriously one of the reasons I have never owned an iOS device. I too care about timestamps and iOS likes to mess with them constantly to the point that it's unusable for me. |
Is it fixed? |
It can't be fixed because it's not broken. Please read my extensive answer that you skipped, it's right above your comment, it will explain everything. Short answer: nothing preserves that, not even Windows itself when you transfer photos from an SD card with the file manager. |
Does your log mention database corruption?
No
Include required information
Please be sure to include at least:
which version of Syncthing and what operating system you are using
v1.25.0, macOS (64-bit ARM)
browser and version, if applicable
Chrome, Arc
what happened,
A file was created on 03-Nov-23, see screenshot highlighted in red box. I did a simple update to this file, and you can see modified date shown today date & time (05-Nov-23 11:45). However, when I sync to iPhone, the creation date become today's date.
MacOS Screenshot:
![image](https://private-user-images.githubusercontent.com/97268671/280509426-7aa7beb3-f22f-41d5-82ec-ca55fe93fb47.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxNTk0OTAsIm5iZiI6MTcyMjE1OTE5MCwicGF0aCI6Ii85NzI2ODY3MS8yODA1MDk0MjYtN2FhN2JlYjMtZjIyZi00MWQ1LTgyZWMtY2E1NWZlOTNmYjQ3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI4VDA5MzMxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE5ODk5ZjFmZjJmNWU1NmYwNmQ1NzBiYzMzMmUyNTlmZTk5Y2FhNzI3ZDJiZGVhZTE1NjExNGM1OTliYmYwNDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4aVhtnh9IXQqNgSPYNZ5AUtYW1X982TzGsEQO0m6dWY)
iPhone Screenshot:
![image](https://private-user-images.githubusercontent.com/97268671/280509435-218748cf-b493-4a9f-86ac-8d225c4a6543.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxNTk0OTAsIm5iZiI6MTcyMjE1OTE5MCwicGF0aCI6Ii85NzI2ODY3MS8yODA1MDk0MzUtMjE4NzQ4Y2YtYjQ5My00YTlmLTg2YWMtOGQyMjVjNGE2NTQzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI4VDA5MzMxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM3YWJiMDEyYjZmODZhMzM0OTFhMjg2ZjBkMjkwNGI4ZDAyMTQ1NmM4Njk2YzdlZTQ3NDk2MzUzNzY4N2E0MzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.EQ8Whcx1Mv4ZZ7o_PJiogROojNVrMhMio4d3jqV7O2U)
what you expected to happen instead, and
Original file creation date should not be modified. It preserves the creation date of the file which is important for checking subsequently.
any steps to reproduce the problem.
Modify the file in macbook, sync it in mobile.
The text was updated successfully, but these errors were encountered: