     wipeCache();
   } else {
     caching = true;
-    listDir(SPIFFS, " / ", "");
+    unsigned long count = listDir(SPIFFS, "/", "");
+    Serial.println("Total of " + String(count, DEC) + " files.");
   };
 
   Serial.println("setup() done.\n\n");
 }
 
 // This function is taken from the SPIFFS_Test example. Under the expressif ESP32 license.
+// It returns the number of entries found (files only).
 //
-void listDir(fs::FS &fs, const char * dirname, String prefix) {
+unsigned long listDir(fs::FS &fs, const char * dirname, String prefix) {
   Serial.print(prefix);
   Serial.println(dirname);
+  unsigned long count = 0;
 
   File root = fs.open(dirname);
   if (!root) {
     Serial.println("Failed to open directory");
-    return;
+    return 0;
   }
   if (!root.isDirectory()) {
     Serial.println("Not a directory");
-    return;
+    return 0;
   }
 
   File file = root.openNextFile();
   while (file) {
     if (file.isDirectory()) {
-      listDir(fs, file.name(), prefix + " ");
+      count += listDir(fs, file.name(), prefix + " ");
     } else {
       Serial.print(prefix + " ");
       Serial.println(file.name());
+      count ++;
     }
     file = root.openNextFile();
   }
   root.close();
+  return count;
 }
 
 void wipeCache() {


void openDoor() {
  doorstate = OPEN;

  // Engage solenoid.
  digitalWrite(SOLENOID_GPIO, LOW);

  if (p)
    strncpy(pname, p + 1, sizeof(pname));

  if ((p = index(pname, '.')))
    * p = '\0';

#ifndef LOCALMQTT
  // Alert us to safe, non production versions.
