+ #remove a mail message from the db
+ print ("%s is not on the fs anymore. Delete" % absfile)
+ status = db.remove_message(absfile)
+ if status == STATUS.SUCCESS:
+ # we just deleted the last reference, so this was a remove
+ removed += 1
+ sys.stderr.write("SUCCESS %d %s %s.\n" % (status, STATUS.status2str(status), absfile))
+ elif status == STATUS.DUPLICATE_MESSAGE_ID:
+ # The filename exists already somewhere else, so this is a move
+ moved += 1
+ added -= 1
+ sys.stderr.write("DUPE %d %s %s.\n" % (status, STATUS.status2str(status), absfile))
+ else:
+ #This should not occur
+ sys.stderr.write("This should not occur %d %s %s.\n" % (status, STATUS.status2str(status), absfile))
+
+ #list of folders in the filesystem. Just descend into dirs
+ for fs_file in fs_files:
+ absfile = os.path.normpath(os.path.join(db_dir.path, fs_file))
+ if os.path.isdir(absfile):
+ #This is a directory.
+ # Remove it from the db_folder list. All remaining db_folders
+ # at the end will be not present on the file system.
+ db_folders.remove(fs_file)
+ if fs_file in ['.notmuch','tmp','.']: