I want to convert some PDF file to TXT file in a bash script.
pdf2txt.py -o otuput.txt input.pdf
this is the command to do the task for a single file. But for large set of file I am trying to do the following.
#!/bin/bash
cd /home/z..../P...../file/pdf
python << END
import os
file_lst = os.listdir(r'/home/z..../P...../file/pdf')
out_file_lst = []
l = len(file_lst)
for i in file_lst:
out_file_lst.append(file_lst[0].split('.')[0] + '.txt')
for i in range(l):
pdf2txt.py -o out_file_lst[i] file_lst[i]
# How to run this bash command inside of python ?
END