diff --git a/README.md b/README.md index 76982b1..61698bc 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ # tsync -Share your clipboard and files between your machines (macOS, Linux, Windows) from a terminal UI. +Share your clipboard and files between your machines (macOS, Linux, Windows) from a terminal UI, and keep directories in sync between them. -Run `tsync` on each machine of your local network and they find each other. You approve a new machine once, after checking its short hash matches, and from then on they reconnect by themselves over an encrypted link. Paste text in tsync on one machine and click to copy it on another; drop a file in and click to download it on the other side. +Run `tsync` on each machine of your local network and they find each other. You approve a new machine once, after checking its short hash matches, and from then on they reconnect by themselves over an encrypted link. Paste text in tsync on one machine and click to copy it on another; drop a file in and click to download it on the other side. With `-sync` the machines also keep a directory in sync, with or without the UI (see [Directory sync](#directory-sync)). -The `tsnet` and `tcrypto` packages can also be used as a Go library for local network discovery, authenticated and encrypted links between peers, and clipboard/file transfer. +The `tsnet`, `tcrypto` and `syncdir` packages can also be used as a Go library for local network discovery, authenticated and encrypted links between peers, clipboard/file transfer and the directory sync logic. -Clipboard sharing and the file sharing works and is tested between macOS, Windows and Linux machines, including VMs. +Clipboard and file sharing work and are tested between macOS, Windows and Linux machines, including VMs. ![Example Screenshot](screenshot.png) @@ -31,7 +31,7 @@ CGO_ENABLED=0 go run fortio.org/tsync@latest # to run without installing ``` On macOS, leave out `CGO_ENABLED=0` (needs the Xcode command line tools) to get `-sync-watch` with FSEvents. -Use the same version on all your machines: the protocol still changes, and peers running an older one show as "(old version)". +Use the same version on all your machines when you can: the protocol still changes. Versions before 0.15 can't connect and show as "(old version)". ## Usage @@ -56,6 +56,22 @@ Copying uses the OSC 52 escape sequence, which the terminal has to support and a Escape sequences and control characters are removed from the text received before it's displayed or copied. +### Directory sync + +`tsync -sync docs=~/Documents` syncs the content of that directory with the linked peers that use the same label (`docs` here). The label only pairs the directories, which can be anywhere and called anything on each machine (eg `-sync docs=D:\work\papers` on another one). Repeat `-sync` for more directories. Each side gets what the other has new or changed, and a sync box below the files one shows where each folder is at with each peer. + +- Deletions are propagated too: the other side moves its copy to `.tsync-old/`. A file modified on one side since the last sync wins over its deletion on the other, and a peer deleting most files at once (eg its disk not mounted) is held rather than followed. +- Moved or renamed files are moved on the other side too (no new transfer). +- A file changed on both sides since the last sync (a conflict, eg edited on a laptop while offline), or changed on one side and deleted on the other, is resolved without losing anything: the newest version keeps the name and the other one is kept next to it as `name.sync-conflict--