code: private static void indexDirectory(IndexWriter writer, File dir)
          throws IOException {
          
          File[] files = dir.listFiles();
  
          for (int i = 0; i < files.length; i++) {
              File f = files[i];
              if (f.isDirectory()) {
                  indexDirectory(writer, f);
              } else if (f.getName().endsWith(".txt")) {
                  indexFile(writer, f);
              }
          }
      }
docs: recursive method that calls itself when it finds a directory, or indexes if
  it is at a file ending in ".txt"