I am working on a directory syncing program that uses jnotify to check for changes.
The idea is whenever jnotify detects a change, a sync is performed. The problem is that when many files are copied to or modified in a directory, many syncs are performed instead of one large sync.
Ideally if you were to copy 100 large files to directory A, the sync to directory B would not occur until all the files are fully copied to directory A.
I have thought about somehow using a temp directory (A1) to hold files until they are fully copied and then moving them into A1. But this solution does not work well because I am using unison to perform the sync which only sends file deltas - and that is a feature I would like to use and not circumvent.
Perhaps there is a way to use i/jnotify to detect when multiple files are being updated at once?