Skip to main content

CLI tool to synchronize directories using rsync.

Project description

Directory synchronization tool yd

Build and execute rsync commands from TOML configuration files.

Create a config

Create a new configuration called photos with:

yd edit --new photos

This command

  • creates ~/.config/yd/photos.toml (or under $XDG_CONFIG_HOME/yd if set; relative paths are resolved from your home directory), and
  • opens it in the editor selected via EDITOR.

Reopen an existing configuration with:

yd edit photos

Configuration format

Example

# Phone backup
src_home = "/home/alice"
target_home = "/mnt/backup"
backup = "deleted/%Y-%m-%d"
exclude = [".venv/", "__pycache__/"]

[[commands]]
src = "Documents"
exclude = ["*.log"]

[[commands]]
src = "Pictures"
target = "pics-%Y-%m-%d"
delete_extra = false

Leading comment lines directly at the top of the file are treated as the configuration description and are shown by yd ls.

Top-level options

Key Meaning
src_home Base directory for all src paths. Relative paths are resolved from your home directory.
target_home Base directory for all target paths. Relative paths are resolved from your home directory. strftime placeholders such as %Y-%m-%d are supported.
mtp_target Use in-place syncing for MTP targets.
backup Backup directory for replaced or deleted files. Relative paths are resolved from target_home. strftime placeholders are supported.
exclude Exclude patterns applied to every command.

mtp_target matters because rsync normally copies to a temporary file and renames it afterward, but that is not possible when syncing via MTP.

Command options

Key Meaning
src Relative source directory below src_home.
target Relative target directory below target_home; defaults to src. strftime placeholders are supported.
delete_extra Delete files in the target that do not exist in the source. Defaults to true.
exclude Extra exclude patterns for this command only.

Notes

  • src and target must stay within src_home and target_home after path resolution.
  • src_home or target_home may be omitted from the configuration, but every missing value must then be supplied when running (via CLI parameters).
  • Exactly one of --src-home - and --target-home - may read from standard input in a single run.
  • If backup is omitted, yd creates a timestamped backup directory automatically unless --no-backup is specified.
  • If a configured source directory exists but is empty, yd reports that no synchronization was performed for that command. E.g., forgetting to mount an external drive does not delete all corresponding copies on harddrive).

Run a config

Run a saved configuration by name:

yd run photos

Options

Option Meaning
--dry-run Show what would happen without changing files.
--no-backup Disable backup handling for this run.
--keep-newer Skip updates when the target file is newer.
--rename-speedup Enable rsync options tuned for rename-heavy targets. This may require more disk space on the target.
--src-home PATH Override src_home from the config. Use - to read the value from standard input.
--target-home PATH Override target_home from the config. Use - to read the value from standard input.

List configs

List available configurations with:

yd ls

This shows the configuration name together with the optional leading-comment description.

Why yd?

  • Has one character from synchronize and one from directory.
  • Easy to type with both QWERTZ and QUERTY keyboards.
  • Name was still available on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yd_cli-0.10.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yd_cli-0.10-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file yd_cli-0.10.tar.gz.

File metadata

  • Download URL: yd_cli-0.10.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for yd_cli-0.10.tar.gz
Algorithm Hash digest
SHA256 bab692f03bf177945a8f8cb46aaecc98f147d9796e591ffad54dee915b786a1f
MD5 22e1fb78d77240281ab1cd7dd4d703e2
BLAKE2b-256 9fee6406453b86c485ecc9833320d2f0e9dd3e62f5a47ab3137122428f3f65a2

See more details on using hashes here.

File details

Details for the file yd_cli-0.10-py3-none-any.whl.

File metadata

  • Download URL: yd_cli-0.10-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for yd_cli-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a2bbdb6aac1afe8663d5164c4f4d4ebea2a7831037cfa15db7104b7b18ea65cb
MD5 6e976dd2096ed13bc4e6b6e3873fc9e7
BLAKE2b-256 bf074e62da50e37977da94c76e64c290fdac33354f11a8b715531bff9815cea9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page