Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. from os import listdir
  2. from os.path import isfile, join
  3. import subprocess
  4.  
  5. dirPath = ".\PDFs"
  6. outPath = ".\ocrPDFs"
  7. pdfPath = "D:/"
  8. dockerPath = "/data"
  9. files = [f for f in listdir(dirPath) if isfile(join(dirPath, f))]
  10.  
  11. for file in files:
  12. inputPath = str(join(dirPath,file))
  13. outputPath = str(join(outPath,file))
  14. inputPath = inputPath[1:]
  15. inputPath = inputPath.replace("\\","/")
  16. inputPath = dockerPath + inputPath
  17. outputPath = outputPath[1:]
  18. outputPath = outputPath.replace("\\","/")
  19. outputPath = dockerPath + outputPath
  20.  
  21.  
  22. print(inputPath)
  23. #print(outputPath)
  24. command = "docker run -v "+pdfPath+":/data ocrmypdf " + inputPath + " " + outputPath
  25. print(command)
  26. subprocess.call(command, shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement