Reuse known fileids in the scanner

Saves having to do multiple `getId` calls for every file and folder being scanned.

Saves about 50% of the database class made during a filescan

cc @PVince81 @DeepDiver1975 @th3fallen