`watcher` is a Go package for watching for files or directory changes (recursively or non recursively) without using filesystem events, which allows it to work cross platform consistently.
`watcher` watches for changes and notifies over channels either anytime an event or an error has occurred.
Events contain the `os.FileInfo` of the file or directory that the event is based on and the type of event and file or directory path.
In this example, `watcher` will ignore dot files and folders and won't watch any of the specified folders recursively. It will also run the script `./myscript` anytime an event occurs while watching `main.go` or any files or folders in the previous directory (`../`).
Using the `pipe` and `cmd` flags together will send the event's info to the command's stdin when changes are detected.
First create a file called `script.py` with the following contents:
```python
import sys
for line in sys.stdin:
print (line + " - python")
```
Next, start watcher with the `pipe` and `cmd` flags enabled:
```shell
watcher -cmd="python script.py" -pipe=true
```
Now when changes are detected, the event's info will be output from the running python script.