The server Sync a folder
Sync a folder
@rebofiles/sync keeps a folder of the disk the same as one of the drive. Each run lists both and compares them with what they were when last the same, so it knows which side changed.On this page
In the desktop application
Server → Sync a Folder… (⇧⌘S) asks which folder, ~/ReboFiles unless said, and keeps it while the window is open: when it starts, when the drive tells a change, when the window comes back to the front, and every half a minute. The chip at the bottom says how it went. The disk is read and written by the application’s own commands, which never leave that folder.
As a command
On any computer with Node, also as a service.
npx rebofiles-sync ~/ReboFiles --server https://app.example.com/api/files --token "$TOKEN"
npx rebofiles-sync ./Clients --server … --folder <id of a folder of the drive> --onceIn your code
import { createDriveClient } from '@rebofiles/drive';
import { watchSync } from '@rebofiles/sync';
const client = createDriveClient({ base: 'https://app.example.com/api/files', headers: () => ({ authorization: `Bearer ${token}` }) });
const sync = watchSync({ client, folder: '/Users/ana/ReboFiles', onAction: (action) => console.log(action) });
// sync.stop()What it does
| When | It |
|---|---|
| New on one side | Made on the other: a folder, or the file sent or taken. |
| Changed on one side | A new version in the drive, or the file on the disk written again. |
| Changed on both | The drive’s at its name; the disk’s beside it as “name (conflict 2026-10-26 14.05).ext”, sent as a file of its own. |
| Gone from the disk | Into the drive’s trash, from where it comes back; unless it changed in the drive since, when it is taken again. |
| Gone from the drive | Aside on the disk, in .rebofiles/removed/; unless it changed on the disk since, when it is sent again. |
| Moved or renamed in the drive | Moved on the disk, a folder with what is in it. |
| A file moved on the disk | Moved in the drive, the same file with its versions, found by its size and time. |
What it does not do
- A folder renamed on the disk is sent again as a new one, and the old one goes to the trash: the files are the same, their versions start again.
- An empty folder of the disk where there were files is taken for a disk not there, and nothing is done until it is told (allowEmpty).
- The files of the systems (.DS_Store, Thumbs.db, ~$ files of Office) are left out, and so is its own .rebofiles folder.
- A file goes whole each time, not the part of it that changed.
Only what changed is sent
A file changed a little goes as a new version of only the parts that changed: each version keeps the SHA-256 of its parts of 8 MiB, and the parts that are the same are copied in the storage from the version before (S3’s UploadPartCopy, a copy on the disk), never sent again. A video of a gigabyte with its title changed sends 8 MiB. Any upload can, with partHashes: true.