initialized the code, add the function to count the number of documents in a directory