| import os | |
| def count_pdfs_in_dir(root_dir): | |
| pdf_count = 0 | |
| for dirpath, dirnames, filenames in os.walk(root_dir): | |
| for filename in filenames: | |
| if filename.lower().endswith('.pdf'): | |
| pdf_count += 1 | |
| return pdf_count | |
| if __name__ == "__main__": | |
| dataset_path = './nature_papers' | |
| total_pdfs = count_pdfs_in_dir(dataset_path) | |
| print(f"Total number of PDF files in '{dataset_path}': {total_pdfs}") | |