-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
33 lines (26 loc) · 929 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sys
import os
from PDF_Processor import PDF_Processor
#input directory containing the pdf files
inputdir = "PDFs/"
#output directory for the txt files
outputdir = "output/"
def getListOfFiles(dirName=os.getcwd()):
# create a list of file and sub directories
# names in the given directory
listOfFile = os.listdir(dirName)
allFiles = list()
# Iterate over all the entries
for entry in listOfFile:
# Create full path
fullPath = os.path.join(dirName, entry)
# If entry is a directory then get the list of files in this directory
if os.path.isdir(fullPath):
allFiles = allFiles + getListOfFiles(fullPath)
else:
allFiles.append(fullPath)
return allFiles
filenames = getListOfFiles(dirName=inputdir)
pdfs = [filename for filename in filenames if filename.endswith(".pdf")]
pp = PDF_Processor()
pp.startProcesses(pdfs, outputdir)