Im trying to convert all the pdf stored in one file, say 60 pdfs into text documents and store them in different folders. the folder should have unique names. i tried this code.The folders where created, but the pdftotext conversion command doesnt work in the loop:
import os
def listfiles(path):
    for root, dirs, files in os.walk(path):
        for f in files:
                print(f)
        newpath = r'/home/user/files/'
        p=f.replace("pdf","")
        newpath=newpath+p 
        if not os.path.exists(newpath): os.makedirs(newpath)
        os.system("pdftotext f f.txt")
f=listfiles("/home/user/reports")
 
     
     
    