Do sync programs like Dropbox typically track file changes by doing byte by byte comparisons, or using hashes, or using
diff / keeping local commit logs like version control, or what?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
On Windows there's a mechanism to have the OS alert you when there's a change to a 'watched' directory structure - FindFirstChangeNotification(). When that indicates a file has changed, an application can then go about comparing files in the changed directory to find the actual files that have changed by looking at size, modified date, hash, etc.
This (as Michael points out below) is something that each platform would provide in some manner. I wasnt saying this sort of thing was unique to Windows.
Ultimately to compare files you need to compare every byte - how else would you notice a single byte change?
In reality you read blocks of bytes and compute a hash value, you then check against a list of hashes. A good example is "rsync"
As far as I know dropbox only dedupes entire files, so will compute a hash of the entire file to check fro the same file
.NET for instance has a FileSystemWatcher class. I'm sure other low-level languages and runtimes can provide similar capabilities.