Lwt and directory changes

Hi all,

I have a directory and need to get a notification when a new file appears in it.
Any suggestions on how to do it with Lwt?

Thanks in advance :slight_smile:

I have used this library: lwt-inotify for similar purposes before. I don’t think that inotify has an event specifically for “only when a new file appears in a directory”, but maybe the dune code-base has some example code that does this (with async though).

1 Like

Thanks! It’s exactly what I was looking for.

Note that inotify is Linux only; if you need something more portable (but also more complex), then Irmin has a irmin-watcher library that supports inotify (Linux), fsevents (macOS) and a polling mode (Windows/other).


I don’t need portability right now but it definitely worth a careful look.