We do two pass scanning to figure out our local contents;
-
Walk the folder. For each file check if it's already in the database and is a match, otherwise hash it and add to the database. Database is indexes by file name.
-
Iterate over the database, issuing an os.Lstat() for each item in it. If we get back an error, note the file as deleted.
This breaks when a file is renamed case-only on a case insensitive file system. In step one we find it as a new file, since the database is case