Stop *.tmp files from syncing

Hey I was using syncTrayzor from one year in windows, and everything was okay … The last month the app start syncing two files for each file the original file and the *.tmp file as you see in the screenshoot

I searched and I found that I must add in ignore patterns tab the files that I need to skip syncing so I added (*.tmp and **.tmp) as you see in the screenshoot

But that didn’t help at all And the second problem that the other users keep opening the tmp files and told me the file don’t work ! Note: The tmp file not sync in all devices, it sometimes sync them in one device only, and sometimes sync them to all devices. Kindly could you help me how to stop syncing tmp files in the root folder and subfolders ! My second question, why sometimes I found conflicted files ! How I can stop this issue too. Thanks in advanced

You’ll have to train the other users not to try opening them. Besides, on Windows the .tmp extension doesn’t normally have a default file association.

Those .tmp files are part of Syncthing’s sync process so cannot be excluded/ignored (for details, see the Temporary Files section of the Syncthing documentation).

In the same documentation page, the Conflicting Changes section goes into more detail. Conflicts can have several causes including:

  • Syncthing 1.22 (on some devices it can result in conflicts).
  • Clock is incorrect on some device(s).
  • Users are editing the same file(s) via multiple devices.

But why before SyncTroizer wasn’t sync tmp files ? and just started doing that from the lest month, I told the other users to not open tmp files, but as you can see they made adobe dc as the default xDD In same cases before it was sync office files, like docx, pptx, etc, but now it generate tmp file for all file extinctions pdf psd jpg etc … Some times I found hundred of them, and I must to remove them one by one ! :confused:

So the key to understanding this is that it’s not SyncTrayzor creating the .tmp files, but rather Syncthing (SyncTrayzor is a wrapper around Syncthing).

As Syncthing’s documentation describes, to avoid partially overwriting a destination file due to a network issue, power outage, file system error, etc., Syncthing does the following:

  1. File A:\notes.txt has changed on device A.
  2. Copy A:\notes.txt from device A to the destination device B, temporarily as B:\~syncthing~notes.txt.tmp.
  3. Once the copy is complete, move B:\~syncthing~notes.txt.tmp to B:\notes.txt

The process above occurs every time a file is created and/or updated and isn’t anything new in Syncthing (or SyncTrayzor).

In Microsoft Windows, any files with a filename beginning with a tilde (~) are treated as being hidden -and- a system file so you wouldn’t normally see the .tmp files created by Syncthing. Chances are that Windows Explorer’s folder options on your Windows machines has been adjusted to show hidden files.

  • Check the version of Syncthing. Make sure that you’re running the latest version.
  • Any .tmp files that hang around could be due to incomplete transfers.
  • You mentioned conflicts but didn’t include any examples.

Screenshots of Syncthing’s interface with details of the Syncthing folders and devices would be very helpful.

This. The root cause will be that the sync cannot complete for some reason, which will be visible after clicking on the details in the web GUI.

(For the record, I don’t think this is sufficient to cause conflicts. We don’t care too much about the wall clock, it’s mostly a minor factor in determining the winner when a conflict has already happened due to other causes.)

We had the exact same problem when using Syncthing at a school as those temp files were confusing the teachers a lot.

One way is to set to 0 which disables storing temporary files altogether. However, this isn’t ideal as Syncthing only deletes them when performing a scan of the folder, which means that the files themselves can still linger around for a while before they get deleted.

Another method, which we use, is to set a script using Task Scheduler to run attrib +h ~syncthing~*.tmp /s every few minutes which will look for and hide all Syncthing temp files in your folder of choice, including all subfolders.

I’m sorry to say this, but the above is incorrect. The ~ tilde (or any other similar character) has no special meaning in Windows. Syncthing does hide those files (by adding the hidden attribute to them) but only while they are still in transfer. Once the transfer has been interrupted, etc., the hidden attribute is removed, and then they become visible to the user.

What’s the typical cause for them remaining around? Target file in use? Permissions?

Sometimes being in use, but in our case it was simply the remote device becoming unavailable :wink:. The ideal solution for us would be to have an option to just keep them hidden all the time.

1 Like

Thanks @tomasz86. I could have written that part of my post above a lot better, so here goes… :wink:

Here’s a hands on experiment:

  1. Pick any edition of Windows from 7 thru 10 (I don’t currently use Windows 11, but it’s probably fine too).
  2. Launch a command-prompt.
  3. Via the command-prompt, create a pair of text files (for convenience, I’m choosing the desktop):
echo > %HOMEPATH%\Desktop\ABC.txt
echo > %HOMEPATH%\Desktop\~ABC.txt
  1. The two files above should have appeared on the desktop. Now let’s mark them with the hidden attribute (can also be done via Windows Explorer, makes no difference):
attrib +h %HOMEPATH%\Desktop\ABC.txt
attrib +h %HOMEPATH%\Desktop\~ABC.txt
  1. So, what happens to the two files above when the hidden files and folders setting is enabled/disabled in Windows Explorer?

The tilde (~) as the first character of a filename has special meaning in Windows, but the exact behavior varies depending on the local settings and the vintage of Windows (Windows 7 includes a bonus that was removed in newer editions).

The feature – a deliberate design decision – is also filesystem agnostic, supported on even SMB network drives hosted by Samba on Linux. It was designed to help reduce clutter since many applications start filenames of temporary files with a tilde.

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