Registry / devops / dirsync

dirsync

JSON →
library2.2.6pypypi✓ verified 35d ago

dirsync is an advanced Python library and command-line tool for synchronizing directory trees. It is based on Anand B Pillai's Python robocopier and provides functionalities like reporting differences, syncing content, and updating existing content with various options for filtering and behavior. The current version is 2.2.6, and it appears to have a stable, though infrequent, release cadence.

devopsdata
Install & Compatibility
Where this runs
tested against v2.2.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.051s · 17.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.044s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from dirsync import sync

This quickstart demonstrates how to use the `sync` function to synchronize files from a source directory to a target directory. It includes creating dummy directories and files, performing a 'sync' operation with verbose output and target directory creation, and finally cleaning up.

import os from dirsync import sync # Create dummy source and target directories for demonstration source_dir = './source_data' target_dir = './target_data' os.makedirs(source_dir, exist_ok=True) os.makedirs(target_dir, exist_ok=True) with open(os.path.join(source_dir, 'file1.txt'), 'w') as f: f.write('Hello from source!') with open(os.path.join(source_dir, 'file2.log'), 'w') as f: f.write('Log content.') print(f"Synchronizing from '{source_dir}' to '{target_dir}'") # Sync: copies all files from source to target, creating target if it doesn't exist sync(source_dir, target_dir, 'sync', verbose=True, create=True) print(f"Content of '{target_dir}': {os.listdir(target_dir)}") # Clean up (optional) os.remove(os.path.join(source_dir, 'file1.txt')) os.remove(os.path.join(source_dir, 'file2.log')) os.rmdir(source_dir) os.remove(os.path.join(target_dir, 'file1.txt')) os.remove(os.path.join(target_dir, 'file2.log')) os.rmdir(target_dir)
dirsync --version
Debug
Known footguns
gotchaThe `action` parameter (e.g., 'sync', 'diff', 'update') is mandatory when calling `dirsync.sync` from Python or using the command-line tool. Omitting it will result in an error or unexpected behavior.
gotchaBy default, the target directory must exist. If it doesn't, `dirsync` will fail. To automatically create the target directory if it's missing, you must explicitly use the `create=True` option in the Python API or `--create` flag in the CLI.
gotchaWhen using `ignore`, `only`, `exclude`, or `include` options, the patterns provided are regular expressions and must match the *entire path* from the beginning. For the Python API, these options expect a list of regex strings.
gotchaConfiguration files (`.dirsync` in user's home or source/target directories) are only parsed and used when `dirsync` is run from the command line. They are ignored when the `sync` function is called directly from Python code.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
15 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
bytedance
1
Resources