ReadDirectoryChangesW File Moved Workaround

1k views Asked by At

Background

Windows API for monitoring file-system changes ReadDirectoryChangesW cannot reliably report a file move operation. Instead it just notifies Deleted + Created.

Question

What workarounds can be implemented to achieve such a 'Move Event' effect on Windows? I'm sure I'm not the first one who's dealt with this.


My own first thoughts were to save SHA1 sums of everything in the monitored directory (perhaps in a SQLite database) and compare the changed file with the SHA1s, so that if a delete+create happens and their sha1 sums match, we can safely assume it was a move operation. This feels a bit overkill though, I'm wondering if anyone else has already figured out some better workaround.

Any ideas?

0

There are 0 answers