Monitor Directory modification and
List of directory (3 ways) might be helpful. If I was to try and come up with something from scratch, I would first try something with
lsof, to detect when a file closes.
I'm not saying it is the best solution, but I would setup a set of timers, as in
Roll your own Event-loop , and be stuffing filenames into hashes and checking their status in a timer, then do whatever.