dirsync
=======
|copyright| 2014-2019 Thomas Khyn
|copyright| 2003-2015 Anand B Pillai
Advanced directory tree synchronisation tool
based on `Python robocopier`_ by Anand B Pillai
If you like dirsync and are looking for a way to thank me and/or encourage
future development, here is my BTC or BCH donation address:
``1EwENyR8RV6tMc1hsLTkPURtn5wJgaBfG9``.
Usage
-----
From the command line::
dirsync <sourcedir> <targetdir> [options]
From python::
from 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 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 dirsync is called from within Python.
If you want to use predefined options all the time, or if you need specific
options when 'dirsyncing' a specific source directory, dirsync looks for
two configuration files, by order or priority (the last takes precedence)::
~/.dirsync
source/directory/.dirsync
.. note::
A ~/.dirsync configuration file is automatically created the first time
dirsync is ran from the command line. It enables ``sync`` mode by default.
.. warning::
Any ``source/directory/.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/
Raw data
{
"_id": null,
"home_page": "https://github.com/tkhyn/dirsync/",
"name": "dirsync",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "directory,folder,update,synchronisation",
"author": "Thomas Khyn",
"author_email": "thomas@ksytek.com",
"download_url": "https://files.pythonhosted.org/packages/a0/df/f3e546194fd6e179a47e27ba4bc3c25fd5bf3cba17d4fe765ec037c572e3/dirsync-2.2.5.tar.gz",
"platform": "",
"description": "dirsync\n=======\n\n|copyright| 2014-2019 Thomas Khyn\n|copyright| 2003-2015 Anand B Pillai\n\nAdvanced directory tree synchronisation tool\n\nbased on `Python robocopier`_ by Anand B Pillai\n\nIf you like dirsync and are looking for a way to thank me and/or encourage\nfuture development, here is my BTC or BCH donation address:\n``1EwENyR8RV6tMc1hsLTkPURtn5wJgaBfG9``.\n\nUsage\n-----\n\nFrom the command line::\n\n dirsync <sourcedir> <targetdir> [options]\n\nFrom python::\n\n from dirsync import sync\n sync(sourcedir, targetdir, action, **options)\n\n\nMain Options\n------------\n\nChosing one option among the following ones is mandatory\n\n--diff, -d Only report difference between sourcedir and targetdir\n--sync, -s Synchronize content between sourcedir and targetdir\n--update, -u Update existing content between sourcedir and targetdir\n\nIf you use one of the above options (e.g. ``sync``) most of the time, you\nmay consider defining the ``action`` option in a `Configuration file`_ parsed\nby dirsync.\n\n\nAdditional Options\n------------------\n\n--verbose, -v Provide verbose output\n--purge, -p Purge files when synchronizing (does not purge by\n default)\n--force, -f Force copying of files, by trying to change file\n permissions\n--twoway, -2 Update files in source directory from target\n directory (only updates target from source by default)\n--create, -c Create target directory if it does not exist (By\n default, target directory should exist.)\n--ctime Also takes into account the source file\\'s creation\n time (Windows) or the source file\\'s last metadata\n change (Unix)\n--content Takes into account ONLY content of files. \n Synchronize ONLY different files.\n At two-way synchronization source files content \n have priority if destination and source are existed\n--ignore, -x patterns Regex patterns to ignore\n--only, -o patterns Regex patterns to include (exclude every other)\n--exclude, -e patterns Regex patterns to exclude\n--include, -i patterns Regex patterns to include (with precedence over\n excludes)\n\n\nConfiguration file\n------------------\n\n.. note::\n Configuration files are only used when using the command line, and ignored\n when dirsync is called from within Python.\n\nIf you want to use predefined options all the time, or if you need specific\noptions when 'dirsyncing' a specific source directory, dirsync looks for\ntwo configuration files, by order or priority (the last takes precedence)::\n\n ~/.dirsync\n source/directory/.dirsync\n\n.. note::\n A ~/.dirsync configuration file is automatically created the first time\n dirsync is ran from the command line. It enables ``sync`` mode by default.\n\n.. warning::\n Any ``source/directory/.dirsync`` file is automatically excluded from the\n files to compare. You have to explicitly include using the ``--include``\n option it if you want it to be covered by the comparison.\n\nThe command line options always override the values defined in the\nconfiguration files.\n\nThe configuration files must have a ``defaults`` section, and the options are\nas defined above. The only exception is for the option ``action``, which can\ntake 3 values ``diff``, ``sync`` or ``update``.\n\nExample config file::\n\n [defaults]\n action = sync\n create = True\n\n\nCustom logger\n-------------\n\nFrom python, you may not want to have the output sent to ``stdout``. To do so,\nyou can simply pass your custom logger via the ``logger`` keyword argument of\nthe ``sync`` function::\n\n sync(sourcedir, targetdir, action, logger=my_logger, **options)\n\n\n.. |copyright| unicode:: 0xA9\n\n.. _`Python robocopier`: http://code.activestate.com/recipes/231501-python-robocopier-advanced-directory-synchronizati/",
"bugtrack_url": null,
"license": "",
"summary": "Advanced directory tree synchronisation tool",
"version": "2.2.5",
"project_urls": {
"Homepage": "https://github.com/tkhyn/dirsync/"
},
"split_keywords": [
"directory",
"folder",
"update",
"synchronisation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a0dff3e546194fd6e179a47e27ba4bc3c25fd5bf3cba17d4fe765ec037c572e3",
"md5": "e3ce198b638fe7a5f54a073e76b82266",
"sha256": "1e3a4cd2b639a2eae5afc03c2b8a003fc43d56a0da5114db579386da9a14a8be"
},
"downloads": -1,
"filename": "dirsync-2.2.5.tar.gz",
"has_sig": false,
"md5_digest": "e3ce198b638fe7a5f54a073e76b82266",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13457,
"upload_time": "2020-07-31T23:21:46",
"upload_time_iso_8601": "2020-07-31T23:21:46.980812Z",
"url": "https://files.pythonhosted.org/packages/a0/df/f3e546194fd6e179a47e27ba4bc3c25fd5bf3cba17d4fe765ec037c572e3/dirsync-2.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-07-31 23:21:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tkhyn",
"github_project": "dirsync",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "dirsync"
}