In a trie of directories. Each node can store the last scan time. Candidate library: pattern-trie
pattern-trie