Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from os import listdir
- from os.path import isfile, join
- import subprocess
- dirPath = ".\PDFs"
- outPath = ".\ocrPDFs"
- pdfPath = "D:/"
- dockerPath = "/data"
- files = [f for f in listdir(dirPath) if isfile(join(dirPath, f))]
- for file in files:
- inputPath = str(join(dirPath,file))
- outputPath = str(join(outPath,file))
- inputPath = inputPath[1:]
- inputPath = inputPath.replace("\\","/")
- inputPath = dockerPath + inputPath
- outputPath = outputPath[1:]
- outputPath = outputPath.replace("\\","/")
- outputPath = dockerPath + outputPath
- print(inputPath)
- #print(outputPath)
- command = "docker run -v "+pdfPath+":/data ocrmypdf " + inputPath + " " + outputPath
- print(command)
- subprocess.call(command, shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement