Cross-platform file synchronization tool syncthing

Original link: https://jasonkayzk.github.io/2022/10/19/%E8%B7%A8%E5%B9%B3%E5%8F%B0%E6%96%87%E4%BB%B6% E5%90%8C%E6%AD%A5%E5%B7%A5%E5%85%B7syncthing/

Recently, there is a need to synchronize some files on multiple devices, so the open source software syncthing is used;

It’s pretty good to use, share it here!

Source code:

Cross-platform file synchronization tool syncthing

The background is that there are some files that need to be synced between my win10 desktop, virtual machine, development machine, and my Mac;

But sometimes I am at home, sometimes I am at the company;

At this point, you can use the development machine as an intermediate node for file synchronization through syncthing;

All other devices can synchronize the same directory under the development machine together to complete the file synchronization between all devices!

First deploy with Docker on the development machine:

syncthing.sh

 docker run -itd --network=host -v /root/data/docker-volumn/sync-thing:/var/syncthing --restart=always --name=my-syncthing --privileged=true syncthing/syncthing:1.22

Here, the /root/data/docker-volumn/sync-thing directory is mounted into the container and used as the file path outside the container;

At the same time, syncthing provides a large number of tools for various platforms:

On Win10 desktop, I used:

On Mac I used:

In the virtual machine, I also use the Docker deployment method;

After syncthing is installed on all devices, a simple configuration is required to complete the device connection:

Mainly, click “Add New Device” to open the following page:

Then click “Advanced”:

Just write the address of the peer to be synchronized (here is the development machine) in Addresses, for example:

 tcp://127.0.0.1:22000

The default sync port number is 22000!

The final configured result is as follows:

syncthing.png

At this point, any files changed in the sync-files directory on any device will be synchronized to all other devices, which is very convenient!

appendix

Source code:

This article is reprinted from: https://jasonkayzk.github.io/2022/10/19/%E8%B7%A8%E5%B9%B3%E5%8F%B0%E6%96%87%E4%BB%B6% E5%90%8C%E6%AD%A5%E5%B7%A5%E5%85%B7syncthing/
This site is for inclusion only, and the copyright belongs to the original author.