Advanced directory tree synchronisation tool
Project description
d51_dirsync
Based on dirsync by Thomas Khyn and robocopier by Anand B Pillai
|copyright| 2014-2020 Thomas Khyn |copyright| 2003-2015 Anand B Pillai
Advanced directory tree synchronisation tool
based on Python robocopier
_ by Anand B Pillai
If you like d51_dirsync and find it useful, you may want to thank me and
encourage future development by sending a few mBTC / mBCH / mBSV at this address:
1EwENyR8RV6tMc1hsLTkPURtn5wJgaBfG9
.
Usage
From the command line::
d51_dirsync [options]
From python::
from d51_dirsync import sync sync(sourcedir, targetdir, action, **options)
Main Options
Chosing one option among the following ones is mandatory
--diff, -d Only report difference between sourcedir and targetdir --sync, -s Synchronize content between sourcedir and targetdir --update, -u Update existing content between sourcedir and targetdir
If you use one of the above options (e.g. sync
) most of the time, you
may consider defining the action
option in a Configuration file
_ parsed
by d51_dirsync.
Additional Options
--verbose, -v Provide verbose output --purge, -p Purge files when synchronizing (does not purge by default) --force, -f Force copying of files, by trying to change file permissions --twoway, -2 Update files in source directory from target directory (only updates target from source by default) --create, -c Create target directory if it does not exist (By default, target directory should exist.) --ctime Also takes into account the source file's creation time (Windows) or the source file's last metadata change (Unix) --content Takes into account ONLY content of files. Synchronize ONLY different files. At two-way synchronization source files content have priority if destination and source are existed --ignore, -x patterns Regex patterns to ignore --only, -o patterns Regex patterns to include (exclude every other) --exclude, -e patterns Regex patterns to exclude --include, -i patterns Regex patterns to include (with precedence over excludes)
Configuration file
.. note:: Configuration files are only used when using the command line, and ignored when d51_dirsync is called from within Python.
If you want to use predefined options all the time, or if you need specific options when 'd51_dirsyncing' a specific source directory, d51_dirsync looks for two configuration files, by order or priority (the last takes precedence)::
~/.d51_dirsync
source/directory/.d51_dirsync
.. note::
A ~/.d51_dirsync configuration file is automatically created the first time
d51_dirsync is ran from the command line. It enables sync
mode by default.
.. warning::
Any source/directory/.d51_dirsync
file is automatically excluded from the
files to compare. You have to explicitly include using the --include
option it if you want it to be covered by the comparison.
The command line options always override the values defined in the configuration files.
The configuration files must have a defaults
section, and the options are
as defined above. The only exception is for the option action
, which can
take 3 values diff
, sync
or update
.
Example config file::
[defaults] action = sync create = True
Custom logger
From python, you may not want to have the output sent to stdout
. To do so,
you can simply pass your custom logger via the logger
keyword argument of
the sync
function::
sync(sourcedir, targetdir, action, logger=my_logger, **options)
.. |copyright| unicode:: 0xA9
.. _Python robocopier
: http://code.activestate.com/recipes/231501-python-robocopier-advanced-directory-synchronizati/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file d51_dirsync-2.2.7.tar.gz
.
File metadata
- Download URL: d51_dirsync-2.2.7.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d925ca96228cff55fd42dee50ad5100ddd760810e4d51598b305b2fa1f20bac2 |
|
MD5 | 61a46e4e94216eddeedfd7c1c6062f2f |
|
BLAKE2b-256 | fab7fcf222588fc8c19f41f015b82ab2138f47c29d63db215341d5bc23511958 |
File details
Details for the file d51_dirsync-2.2.7-py3-none-any.whl
.
File metadata
- Download URL: d51_dirsync-2.2.7-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48b183520824000360b7489b1bc6923db312b14968f9aaec3068c7c2b7035ace |
|
MD5 | 206fad480c3ed4fb24c5eece55aa7e51 |
|
BLAKE2b-256 | 67f4991ead2a8f8440c004d99af9ac1579dd91d8fa9e141fa566eca11e49bf2d |