file-directory-watcher


Namefile-directory-watcher JSON
Version 0.0.10 PyPI version JSON
download
home_page
SummaryCLI tool for monitoring changes, additions, removals in files and directories and optionally running commands on specified operations.
upload_time2023-08-16 17:16:54
maintainer
docs_urlNone
author
requires_python
license
keywords file directory watcher fdw changes monitoring monitor watch
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 📁🔍 fdw - CLI tool for watching files and directories changes

Command line tool for monitoring changes, additions and removals in files and directories.
It also offers the option to run commands on specified operations.

![Screenshot of fdw program running](images/fdw-running-normal.jpg)


- [Instalation](#instalation)
- [Usage](#usage)
  - [Examples](#examples)
    - [Simple](#simple)
    - [Advanced](#advanced)
  - [Options](#options)
    - [Patterns for files and directories](#patterns-for-files-and-directories)
    - [Configuration options](#configuration-options)
    - [Commands to run on specified operations](#commands-to-run-on-specified-operations)
    - [Other options](#other-options)


## Instalation

No external dependecies required! 🚫🧰

```bash
$ pip3 install file-directory-watcher
```
[![PyPI](https://img.shields.io/pypi/v/file-directory-watcher?color=0073b7&style=for-the-badge)](https://pypi.org/project/file-directory-watcher/)

Tips:
- 💡 It is recommended to install it globally, so you can use it from anywhere.

## Usage

`fdw` is a command-line tool and **does not** provide any importable modules.

```bash
$ fdw pattern [pattern ...] [--exclude pattern ...] [options]
```

### Examples
#### Simple
```bash
$ fdw "**/*.py" --interval 1s --on-file-change "echo Python file changed"
```

Tips:
- 💡 Surround patterns with quotes to prevent shell expansion.
- 💡 You can use short versions of options. e.g. `-i` instead of `--interval`.

#### Advanced
```bash
$ fdw \
"src/**/*.py" \
--exclude "/home/username/project/src/**/__pycache__/**/*" \
--interval 1s \
--background \
--only file_added \
--on-file-add "git add %relative_path" \
--verbosity full \
```

Tips:
- 💡 Instead of exluding a folder with large number of files, try including only the files you are interested in.
  This will improve the performance and reduce CPU usage.

### Options

#### Patterns for files and directories

<table>
    <tr>
        <th>Option</th>
        <th>Value</th>
        <th>Description</th>
    </tr>
    <tr>
        <td>(positional)</td>
        <td rowspan=2><code>pattern</code></td>
        <td>Glob pattern to watch for changes. You can specify one or more patterns.</td>
    </tr>
    <tr>
        <td><code>--exclude</code></td>
        <td>Glob patterns to exclude from watching. You can specify one or more exclusion patterns.</td>
    </tr>
</table>


#### Configuration options

<table>
    <tr>
        <th>Option</th>
        <th>Value</th>
        <th>Description</th>
    </tr>
    <tr>
        <td>
            <code>-i</code>,
            </br>
            <code>--interval</code>
        </td>
        <td rowspan=2>e.g. <code>0.5s</code>, <code>1m</code>, <code>2h30m</code>, <code>1d12h</code></td>
        <td>Interval between running the watcher. Default: <code>1s</code>.</td>
    </tr>
    <tr>
        <td>
            <code>-d</code>,
            </br>
            <code>--delay</code>
        </td>
        <td>Delay between files. Default: <code>0s</code>.</td>
    </tr>
    <tr>
        <td>
            <code>-b</code>,
            </br>
            <code>--background</code>
        </td>
        <td>-</td>
        <td>
            Run commands in the background as non-blocking processes.
            The <code>fdw</code> process itself is stil in foreground.
        </td>
    </tr>
    <tr>
        <td><code>--only</code></td>
        <td rowspan=2>
            <code>file_changed</code>,
            <code>file_added</code>,
            <code>file_modified</code>,
            <code>file_removed</code>,
            <code>directory_changed</code>,
            <code>directory_added</code>,
            <code>directory_modified</code>,
            <code>directory_removed</code>
            <br>
            or short versions
            <br>
            <code>fc</code>,
            <code>fa</code>,
            <code>fm</code>,
            <code>fr</code>,
            <code>dc</code>,
            <code>da</code>,
            <code>dm</code>,
            <code>dr</code>
        </td>
        <td>Operations to watch for. Default: <code>all</code>.</td>
    </tr>
    <tr>
        <td><code>--ignore</code></td>
        <td>Operations to ignore. Default: <code>none</code>.</td>
    </tr>
    <tr>
        <td>
            <code>--fcm</code>,
            </br>
            <code>--file-compare-method</code>
        </td>
        <td>
            <code>mtime</code>,
            <code>size</code>,
            <code>md5</code>,
            <code>mode</code>,
            <code>uid</code>,
            <code>gid</code>
        </td>
        <td>Methods to compare files. Default: <code>mtime</code></td>
    </tr>
    <tr>
        <td>
            <code>--dcm</code>,
            </br>
            <code>--directory-compare-method</code>
        </td>
        <td>
            <code>mtime</code>,
            <code>mode</code>,
            <code>uid</code>,
            <code>gid</code>
        </td>
        <td>Methods to compare directories. Default: <code>mtime</code></td>
    </tr>
    <tr>
        <td>
            <code>-v</code>,
            </br>
            <code>--verbosity</code>
        </td>
        <td>
            <code>limited</code>,
            <code>normal</code>,
            <code>full</code>
        </td>
        <td>Set output verbosity. Default: <code>normal</code>.</td>
    </tr>
    <tr>
        <td>
            <code>--nc</code>,
            </br>
            <code>--no-color</code>
        </td>
        <td>-</td>
        <td>Disable colored output.</td>
    </tr>
</table>

#### Commands to run on specified operations

<table>
    <tr>
        <th>Option</th>
        <th>Value</th>
        <th>Description</th>
    </tr>
    <tr>
        <td>
            <code>--oc</code>,
            </br>
            <code>--on-change</code>
        </td>
        <td rowspan=12><code>command</code></td>
        <td>Commands to run when a file or directory is added, modified, or removed.</td>
    </tr>
    <tr>
        <td>
            <code>--oa</code>,
            </br>
            <code>--on-add</code>
        </td>
        <td>Commands to run when a file or directory is added.</td>
    </tr>
    <tr>
        <td>
            <code>--om</code>,
            </br>
            <code>--on-modify</code>
        </td>
        <td>Commands to run when a file or directory is modified.</td>
    </tr>
    <tr>
        <td>
            <code>--or</code>,
            </br>
            <code>--on-remove</code>
        </td>
        <td>Commands to run when a file or directory is removed.</td>
    </tr>
    <tr>
        <td>
            <code>--ofc</code>,
            </br>
            <code>--on-file-change</code>
        </td>
        <td>Commands to run when a file is added, modified, or removed.</td>
    </tr>
    <tr>
        <td>
            <code>--ofa</code>,
            </br>
            <code>--on-file-add</code>
        </td>
        <td>Commands to run when a file is added.</td>
    </tr>
    <tr>
        <td>
            <code>--ofm</code>,
            </br>
            <code>--on-file-modify</code>
        </td>
        <td>Commands to run when a file is modified.</td>
    </tr>
    <tr>
        <td>
            <code>--ofr</code>,
            </br>
            <code>--on-file-remove</code>
        </td>
        <td>Commands to run when a file is removed.</td>
    </tr>
    <tr>
        <td>
            <code>--odc</code>,
            </br>
            <code>--on-directory-change</code>
        </td>
        <td>Commands to run when a directory is added, modified, or removed.</td>
    </tr>
    <tr>
        <td>
            <code>--oda</code>,
            </br>
            <code>--on-directory-add</code>
        </td>
        <td>Commands to run when a directory is added.</td>
    </tr>
    <tr>
        <td>
            <code>--odm</code>,
            </br>
            <code>--on-directory-modify</code>
        </td>
        <td>Commands to run when a directory is modified.</td>
    </tr>
    <tr>
        <td>
            <code>--odr</code>,
            </br>
            <code>--on-directory-remove</code>
        </td>
        <td>Commands to run when a directory is removed.</td>
    </tr>
</table>

For all commands, you can use the following variable expansions:

<table>
    <tr>
        <th>Variable</th>
        <th>Expanded value</th>
        <th>Description</th>
    </tr>
    <tr>
        <td><code>%name</code></td>
        <td>e.g. <code>README.md</code></td>
        <td>The name of the file or directory.</td>
    </tr>
    <tr>
        <td><code>%relative_path</code></td>
        <td>e.g. <code>../../files/README.md</code></td>
        <td>The relative path of the file or directory.</td>
    </tr>
    <tr>
        <td><code>%absolute_path</code></td>
        <td>e.g. <code>/home/user/files/README.md</code></td>
        <td>The absolute path of the file or directory.</td>
    </tr>
</table>

#### Other options

<table>
    <tr>
        <th>Option</th>
        <th>Value</th>
        <th>Description</th>
    </tr>
    <tr>
        <td><code>--version</code></td>
        <td>-</td>
        <td>Shows program's version number and exit.</td>
    </tr>
    <tr>
        <td><code>-h</code>, <code>--help</code></td>
        <td>-</td>
        <td>Show help message and exit.</td>
    </tr>
</table>

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "file-directory-watcher",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "file,directory,watcher,fdw,changes,monitoring,monitor,watch",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/68/a4/a58c37d3e9c5c4a04e149590812662b72886a9d8bbe58489d92dfafe98de/file-directory-watcher-0.0.10.tar.gz",
    "platform": null,
    "description": "# \ud83d\udcc1\ud83d\udd0d fdw - CLI tool for watching files and directories changes\n\nCommand line tool for monitoring changes, additions and removals in files and directories.\nIt also offers the option to run commands on specified operations.\n\n![Screenshot of fdw program running](images/fdw-running-normal.jpg)\n\n\n- [Instalation](#instalation)\n- [Usage](#usage)\n  - [Examples](#examples)\n    - [Simple](#simple)\n    - [Advanced](#advanced)\n  - [Options](#options)\n    - [Patterns for files and directories](#patterns-for-files-and-directories)\n    - [Configuration options](#configuration-options)\n    - [Commands to run on specified operations](#commands-to-run-on-specified-operations)\n    - [Other options](#other-options)\n\n\n## Instalation\n\nNo external dependecies required! \ud83d\udeab\ud83e\uddf0\n\n```bash\n$ pip3 install file-directory-watcher\n```\n[![PyPI](https://img.shields.io/pypi/v/file-directory-watcher?color=0073b7&style=for-the-badge)](https://pypi.org/project/file-directory-watcher/)\n\nTips:\n- \ud83d\udca1 It is recommended to install it globally, so you can use it from anywhere.\n\n## Usage\n\n`fdw` is a command-line tool and **does not** provide any importable modules.\n\n```bash\n$ fdw pattern [pattern ...] [--exclude pattern ...] [options]\n```\n\n### Examples\n#### Simple\n```bash\n$ fdw \"**/*.py\" --interval 1s --on-file-change \"echo Python file changed\"\n```\n\nTips:\n- \ud83d\udca1 Surround patterns with quotes to prevent shell expansion.\n- \ud83d\udca1 You can use short versions of options. e.g. `-i` instead of `--interval`.\n\n#### Advanced\n```bash\n$ fdw \\\n\"src/**/*.py\" \\\n--exclude \"/home/username/project/src/**/__pycache__/**/*\" \\\n--interval 1s \\\n--background \\\n--only file_added \\\n--on-file-add \"git add %relative_path\" \\\n--verbosity full \\\n```\n\nTips:\n- \ud83d\udca1 Instead of exluding a folder with large number of files, try including only the files you are interested in.\n  This will improve the performance and reduce CPU usage.\n\n### Options\n\n#### Patterns for files and directories\n\n<table>\n    <tr>\n        <th>Option</th>\n        <th>Value</th>\n        <th>Description</th>\n    </tr>\n    <tr>\n        <td>(positional)</td>\n        <td rowspan=2><code>pattern</code></td>\n        <td>Glob pattern to watch for changes. You can specify one or more patterns.</td>\n    </tr>\n    <tr>\n        <td><code>--exclude</code></td>\n        <td>Glob patterns to exclude from watching. You can specify one or more exclusion patterns.</td>\n    </tr>\n</table>\n\n\n#### Configuration options\n\n<table>\n    <tr>\n        <th>Option</th>\n        <th>Value</th>\n        <th>Description</th>\n    </tr>\n    <tr>\n        <td>\n            <code>-i</code>,\n            </br>\n            <code>--interval</code>\n        </td>\n        <td rowspan=2>e.g. <code>0.5s</code>, <code>1m</code>, <code>2h30m</code>, <code>1d12h</code></td>\n        <td>Interval between running the watcher. Default: <code>1s</code>.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>-d</code>,\n            </br>\n            <code>--delay</code>\n        </td>\n        <td>Delay between files. Default: <code>0s</code>.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>-b</code>,\n            </br>\n            <code>--background</code>\n        </td>\n        <td>-</td>\n        <td>\n            Run commands in the background as non-blocking processes.\n            The <code>fdw</code> process itself is stil in foreground.\n        </td>\n    </tr>\n    <tr>\n        <td><code>--only</code></td>\n        <td rowspan=2>\n            <code>file_changed</code>,\n            <code>file_added</code>,\n            <code>file_modified</code>,\n            <code>file_removed</code>,\n            <code>directory_changed</code>,\n            <code>directory_added</code>,\n            <code>directory_modified</code>,\n            <code>directory_removed</code>\n            <br>\n            or short versions\n            <br>\n            <code>fc</code>,\n            <code>fa</code>,\n            <code>fm</code>,\n            <code>fr</code>,\n            <code>dc</code>,\n            <code>da</code>,\n            <code>dm</code>,\n            <code>dr</code>\n        </td>\n        <td>Operations to watch for. Default: <code>all</code>.</td>\n    </tr>\n    <tr>\n        <td><code>--ignore</code></td>\n        <td>Operations to ignore. Default: <code>none</code>.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--fcm</code>,\n            </br>\n            <code>--file-compare-method</code>\n        </td>\n        <td>\n            <code>mtime</code>,\n            <code>size</code>,\n            <code>md5</code>,\n            <code>mode</code>,\n            <code>uid</code>,\n            <code>gid</code>\n        </td>\n        <td>Methods to compare files. Default: <code>mtime</code></td>\n    </tr>\n    <tr>\n        <td>\n            <code>--dcm</code>,\n            </br>\n            <code>--directory-compare-method</code>\n        </td>\n        <td>\n            <code>mtime</code>,\n            <code>mode</code>,\n            <code>uid</code>,\n            <code>gid</code>\n        </td>\n        <td>Methods to compare directories. Default: <code>mtime</code></td>\n    </tr>\n    <tr>\n        <td>\n            <code>-v</code>,\n            </br>\n            <code>--verbosity</code>\n        </td>\n        <td>\n            <code>limited</code>,\n            <code>normal</code>,\n            <code>full</code>\n        </td>\n        <td>Set output verbosity. Default: <code>normal</code>.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--nc</code>,\n            </br>\n            <code>--no-color</code>\n        </td>\n        <td>-</td>\n        <td>Disable colored output.</td>\n    </tr>\n</table>\n\n#### Commands to run on specified operations\n\n<table>\n    <tr>\n        <th>Option</th>\n        <th>Value</th>\n        <th>Description</th>\n    </tr>\n    <tr>\n        <td>\n            <code>--oc</code>,\n            </br>\n            <code>--on-change</code>\n        </td>\n        <td rowspan=12><code>command</code></td>\n        <td>Commands to run when a file or directory is added, modified, or removed.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--oa</code>,\n            </br>\n            <code>--on-add</code>\n        </td>\n        <td>Commands to run when a file or directory is added.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--om</code>,\n            </br>\n            <code>--on-modify</code>\n        </td>\n        <td>Commands to run when a file or directory is modified.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--or</code>,\n            </br>\n            <code>--on-remove</code>\n        </td>\n        <td>Commands to run when a file or directory is removed.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--ofc</code>,\n            </br>\n            <code>--on-file-change</code>\n        </td>\n        <td>Commands to run when a file is added, modified, or removed.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--ofa</code>,\n            </br>\n            <code>--on-file-add</code>\n        </td>\n        <td>Commands to run when a file is added.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--ofm</code>,\n            </br>\n            <code>--on-file-modify</code>\n        </td>\n        <td>Commands to run when a file is modified.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--ofr</code>,\n            </br>\n            <code>--on-file-remove</code>\n        </td>\n        <td>Commands to run when a file is removed.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--odc</code>,\n            </br>\n            <code>--on-directory-change</code>\n        </td>\n        <td>Commands to run when a directory is added, modified, or removed.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--oda</code>,\n            </br>\n            <code>--on-directory-add</code>\n        </td>\n        <td>Commands to run when a directory is added.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--odm</code>,\n            </br>\n            <code>--on-directory-modify</code>\n        </td>\n        <td>Commands to run when a directory is modified.</td>\n    </tr>\n    <tr>\n        <td>\n            <code>--odr</code>,\n            </br>\n            <code>--on-directory-remove</code>\n        </td>\n        <td>Commands to run when a directory is removed.</td>\n    </tr>\n</table>\n\nFor all commands, you can use the following variable expansions:\n\n<table>\n    <tr>\n        <th>Variable</th>\n        <th>Expanded value</th>\n        <th>Description</th>\n    </tr>\n    <tr>\n        <td><code>%name</code></td>\n        <td>e.g. <code>README.md</code></td>\n        <td>The name of the file or directory.</td>\n    </tr>\n    <tr>\n        <td><code>%relative_path</code></td>\n        <td>e.g. <code>../../files/README.md</code></td>\n        <td>The relative path of the file or directory.</td>\n    </tr>\n    <tr>\n        <td><code>%absolute_path</code></td>\n        <td>e.g. <code>/home/user/files/README.md</code></td>\n        <td>The absolute path of the file or directory.</td>\n    </tr>\n</table>\n\n#### Other options\n\n<table>\n    <tr>\n        <th>Option</th>\n        <th>Value</th>\n        <th>Description</th>\n    </tr>\n    <tr>\n        <td><code>--version</code></td>\n        <td>-</td>\n        <td>Shows program's version number and exit.</td>\n    </tr>\n    <tr>\n        <td><code>-h</code>, <code>--help</code></td>\n        <td>-</td>\n        <td>Show help message and exit.</td>\n    </tr>\n</table>\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "CLI tool for monitoring changes, additions, removals in files and directories and optionally running commands on specified operations.",
    "version": "0.0.10",
    "project_urls": {
        "Repository": "https://github.com/michalpokusa/file-directory-watcher"
    },
    "split_keywords": [
        "file",
        "directory",
        "watcher",
        "fdw",
        "changes",
        "monitoring",
        "monitor",
        "watch"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "668f975b01818ae45292e7b0c6585693e7582c8d6ca29d26b2eacd69eeb8d9e9",
                "md5": "491049af4a3676e0fa4851a93cab6125",
                "sha256": "95a7bb305f791cf62598da3e07d7e6554e383178b4ecb1d7cf4bf3f811712d54"
            },
            "downloads": -1,
            "filename": "file_directory_watcher-0.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "491049af4a3676e0fa4851a93cab6125",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12055,
            "upload_time": "2023-08-16T17:16:53",
            "upload_time_iso_8601": "2023-08-16T17:16:53.651848Z",
            "url": "https://files.pythonhosted.org/packages/66/8f/975b01818ae45292e7b0c6585693e7582c8d6ca29d26b2eacd69eeb8d9e9/file_directory_watcher-0.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68a4a58c37d3e9c5c4a04e149590812662b72886a9d8bbe58489d92dfafe98de",
                "md5": "137a4b5a058804136f88f9b779e4534c",
                "sha256": "26fd4c1b86e1e845f5a19a50885bd0a16e9d76d31f86eb2c9399cf31906e1853"
            },
            "downloads": -1,
            "filename": "file-directory-watcher-0.0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "137a4b5a058804136f88f9b779e4534c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 115425,
            "upload_time": "2023-08-16T17:16:54",
            "upload_time_iso_8601": "2023-08-16T17:16:54.740194Z",
            "url": "https://files.pythonhosted.org/packages/68/a4/a58c37d3e9c5c4a04e149590812662b72886a9d8bbe58489d92dfafe98de/file-directory-watcher-0.0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-16 17:16:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "michalpokusa",
    "github_project": "file-directory-watcher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "file-directory-watcher"
}
        
Elapsed time: 0.10321s