Skip to main content

peter-sync

Bidirectional folder sync from the command line. Define folder pairs, save them as JSON, and keep both sides up to date.

Install

pip install peter-sync

From a local checkout:

python -m pip install -e ".[dev]"

Usage

Open the interactive menu:

peter-sync

Or use subcommands:

peter-sync add notes ~/Documents/Notes ~/Dropbox/Notes
peter-sync add code ~/src/app ~/backup/app --exclude node_modules --exclude .git
peter-sync list
peter-sync exclude code
peter-sync exclude code --add dist
peter-sync exclude code --remove .git
peter-sync exclude code --set node_modules dist
peter-sync sync notes
peter-sync sync
peter-sync watch notes
peter-sync watch --interval 5
peter-sync remove notes

watch is a long-running process. It polls the folders on an interval (default 2 seconds), reloads settings each cycle, and keeps copying or deleting until you press Ctrl+C. Omit the pair name to watch every saved pair.

Settings are stored at ~/.peter-sync/settings.json unless you pass --settings.

Example settings file:

{
  "pairs": [
    {
      "name": "notes",
      "left": "/Users/you/Documents/Notes",
      "right": "/Users/you/Dropbox/Notes",
      "snapshot": ["todo.md"],
      "exclude": ["node_modules", ".git"]
    }
  ]
}

How sync works

  • New files are copied to the other folder.
  • When both sides have the same file, the newer modification time wins.
  • Identical files are left alone.
  • If both files differ and have the same mtime, the pair is reported as a conflict and left unchanged.
  • Each pair can exclude folders. A bare name such as node_modules is skipped anywhere in the tree. A relative path such as build/tmp is skipped only at that location. Excluded folders are not copied, updated, or deleted.
  • After the first sync, deleting a file on one side deletes it on the other. The last file list is stored in the settings JSON.

Publish to PyPI

  1. Create an API token at https://pypi.org/manage/account/token/
  2. Build and upload:
python -m pip install build twine
python -m build
python -m twine upload dist/*

Or publish a GitHub Release and use .github/workflows/publish.yml with trusted publishing (or a PYPI_API_TOKEN repository secret).

Develop

python -m pip install -e ".[dev]"
pytest

Metadata

Release files for peter-sync 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for peter-sync 0.1.2
File Size Uploaded
peter_sync-0.1.2.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for peter-sync 0.1.2
File Interpreter ABI Platform
peter_sync-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / peter_sync-0.1.2.tar.gz

Download URL peter_sync-0.1.2.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d6dbb6a3c3b1dd13f6c657880c203883132da68e0143efb94c5b1decd9e21568
BLAKE2b-256 checksum
How to use checksums
ae7a393d4c173b394af86fab2bb2b1eb64693cb57bc348f0e5888dbf88835e4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / peter_sync-0.1.2-py3-none-any.whl

Download URL peter_sync-0.1.2-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5408f2fdd0a4a312c1eb0842e83a492981a6e76a0ebfbafd1f1acd13aeb13167
BLAKE2b-256 checksum
How to use checksums
625c44a6582dfc1ea49ea83fa36b661463af9fb84f03c2b38841146b3a587e8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page