How to convert a complete subdir of PDF files to text?
Question
Solution
You can use dos command to do that. For example, you can need process files in c:\pdfs and subdirs, you may type the command:
FOR /F "tokens=*" %G IN ('DIR /b /s "c:\pdfs\*.pdf"') do PTCMD "%G"
More detail about the commnad:
DIR /B /S c:\pdfs\*.pdf
lists all files that are named ".pdf"
/B makes the output "bare" with nothing but the file name
/S recurses subdirectories to include their contents if they match the listing criteria
FOR /F processes each item (in this case directories) in the set IN ('[command]') by executing the DO [command]
%G is a parameter, which in this example is a pdf file name
"tokens=*" says that all the characters output in a line (i.e. by the dir command) are assigned to the parameter %G
If you need use it in a batch file, you need replace the %G to %%G.
Related products
- A-PDF Text Extractor Command line - A command line tool to convert PDF files to text.
We always like improving our products based on your suggestions. Please send your feedback (or ask questions) to us in the contact page.