How to sync a few files with another client

How do you sync a few files with another client?

For instance, I have Syncthing syncing a “JOBS” folder on a windows desktop, laptop, and a NAS, and I want to sync a few files with a new client without sharing and syncing the whole “JOBS” directory with it.

I created a new folder on the local, i.e. FEWJOBS, and copied the few files to it from the JOBS folder. It appears to be syncing correctly with the remote but now there are two versions of the files, and I only want one version.

How can I accomplish that? TIA, jts

You can’t, at least not trivially.

The best I can suggest is hardlinking the files into a new directory, but that might be too complicated.

Thank you, I searched and got some documentation, watched some videos, and downloaded software, and I think that will work. I wasn’t aware that hardlinking on windows was available. One of the files is a pretty large SQLite database, and I hope it plays well with it. I will post the results. thanks again, jts

Syncing sqlite databases will definitely not go well, as it’s a memory mapped file and most likely lead to corruption.

It is working well so far. Actually I wasn’t as concerned about the syncing process with the database as I was with the hardlink because I wasn’t familiar with it. Thank you for pointing me in that direction.

I have been syncing databases for a while without any problem, but I am sure you are more experienced in this than I am. I hope syncthing continues to work well with all my files.

One thing I have noticed is the hardlink files do not update instantaneously as I anticipated. Or my little password manager database file has not, although it appears to sync correctly. This may be the vulnerability you were speaking of, or I don’t have the hardlink applied correctly.

Hardlinks don’t work (or rather break) if you replace files, which databases quite often do, as they usually create a new file, write out all the data except the data that has been marked deleted, and rename file on top of the old file.

That’s a completely new file so the hardlink points to the old, now effectively overwritten file on disk.

1 Like

The hardlink is breaking to my KeePass database file, which is unfortunate, but I appreciate the info, and will have uses for hardlinks in the future.

I think it will work to create a directory in my primary work directory which is shared and synced between three clients, isolating the few files that I wish to sync with my iphone, and share this new directory with it also. This should eliminate the multiple file problem and will give me a chance to see how these files are going to work with just Syncthing. It will be a little inconvenient because of the file location, but worth it if this works.

I don’t suppose there is a way to sync individual files, is there, and not all in the folder?

No

Have you tried using ignore patterns (see https://docs.syncthing.net/users/ignoring.html)?

You could use ! to exclude the few files that you want to sync, and ignore everything else with *.

1 Like

Thanks. I could exclude all the other files if they were not changing and accumulating. Perhaps there is a way to exclude all the files in a directory except the subject file(s) in question with a “wild card” or variable?

It seems like this would be a good feature to request in a future release of Syncthing if others would benefit from it, but it may be too difficult of a task for programmers.

thanks again, jts

Yes, Thanks, I had just responded to AudriusButkevicius when you posted. I think that is the route to pursue, and where the solution lies.

You may want to check https://forum.syncthing.net/t/damn-easy-syncing-one-file-only-using-ignores-does-not-work-mac-to-mac/15926.

1 Like

I will, thanks so much to both of you.

Can I place the stignore file on the client shared directory only? Otherwise, I assume Syncthing will ignore these files on my other synced clients and defeat the purpose.

Edit: I may have the solution. I will post the results.

I created a .sfignore file in the \ACADJOBS\PROJECTS directory and shared it with my iPhone. Since the \ACADJOBS directory is the root directory for syncthing with my other clients, it is not using the .stignore with them. It appears to be working.

If this works, I’ve got to figure out the best way to control collateral damage with my database files, or the best way to manage them with syncthing. Others must be syncing them somehow.

thanks again, jts

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