Use dirs() instead of files() when we only want to list directories.
Cache the list of directories in addition to caching the list of all
files.