Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • My file does not exist in the directory when I start my program, so I watch the directory. I think I ran into errors when I added IN_CLOSE_WRITE to my add_watch call, because the path I provided was of a directory not a file. Commented Sep 12, 2022 at 2:27
  • My need is to capture the first write_close event on this file. It is assumed that this file is only ever written once. Commented Sep 12, 2022 at 2:28
  • I believe you can ask inotify about a file and it can tell you if anything has the file open for write. So presumably, if you are notified of the file's creation (or, at least, the directory's modification), and you scandir and the file is there, and then you grab the file with inotify and find nothing has it open for write, you can assume the last write already occurred. I've used this, but I can't recall the exact details. Commented Sep 12, 2022 at 2:35
  • @user10489 what API of inotify is that? Commented Sep 12, 2022 at 3:04
  • inotify is the API. It has a man page and everything. Maybe some day I'll reread it and give you a better answer. :-> But it's there. Commented Sep 12, 2022 at 5:24