huihuixu commited on
Commit
9a2733a
·
verified ·
1 Parent(s): 571215a

Upload test.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. test.py +14 -0
test.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ def count_pdfs_in_dir(root_dir):
4
+ pdf_count = 0
5
+ for dirpath, dirnames, filenames in os.walk(root_dir):
6
+ for filename in filenames:
7
+ if filename.lower().endswith('.pdf'):
8
+ pdf_count += 1
9
+ return pdf_count
10
+
11
+ if __name__ == "__main__":
12
+ dataset_path = './nature_papers'
13
+ total_pdfs = count_pdfs_in_dir(dataset_path)
14
+ print(f"Total number of PDF files in '{dataset_path}': {total_pdfs}")