No description
Find a file
2013-08-15 11:16:25 +02:00
.gitignore Added setup.py 2013-08-15 11:11:38 +02:00
LICENSE s/COPYING/LICENSE 2013-08-15 11:12:56 +02:00
README.md Added setup.py 2013-08-15 11:11:38 +02:00
setup.py Add pyinotify to requires 2013-08-15 11:16:25 +02:00
watchdir Initial commit 2013-08-15 11:05:20 +02:00

watchdir

Watches directories for changes and runs a shell command when something does change.

Very simple, uses pyinotify to detect changes to the directory.

Only actually acts on the IN_CLOSE_WRITE inotify event, that is, when a file is closed after writing. The use case for me is that I'm editing a file, and I want to automatically run some command whenever the file changes. I don't want it to run the command while the file is being edited though, only when I've actually finished writing my changes to it. Just listening to this event seems to work perfectly fine.

usage: watchdir [-h] [-c CMD] [-v] dirs [dirs ...]

Execute commands when files in a directory changes

positional arguments:
  dirs               directories to watch

optional arguments:
  -h, --help         show this help message and exit
  -c CMD, --cmd CMD  command to execute when files change. Use $1 to pass file
                     as argument. (default: echo $1)
  -v, --verbose      Verbose output (default: False)