There seems to be no copy event in the FileSystemWatcher class.
How best could I detect copies?
Currently, I have indexed all the MD5 checksums for for within the watched folder; should I just run a linear search of the index, on every Create
event, for duplicate MD5s?
The FileSystemWatcher
class receives low-level input, so essentially you are stuck with Create
for any Copy & Move operations.
Creating hashes and comparing them is probably the only reliable way of detecting copies.
Sadly it also has some major drawbacks, like the relatively high CPU/Drive resource cost when one or even multiple files are changed. Since you would need to monitor any file changes, and keep those hashes up to date. Think about large files, it might take a while to compute those hashes, what if a copy operations completed while you still need to calculate that hash update? At that point there's a copy in the wild you don't even recognize as one.