Dec-16-2018, 03:20 PM
(Dec-16-2018, 11:57 AM)Pedroski55 Wrote: I have 300+ files to convert, so a script is very useful.If i try to doing it with code used over.
So it's command line based,to not rewrite can use subprocess in a loop.
import glob import subprocess for start,file in enumerate(glob.glob("*.txt"), 1): subprocess.run(['python', 'txt2pdf.py', '--output', f'txt{start}.pdf', file])So glob find all .txt in folder,then use output argument to make new file name each time.
So output will be.
Output:txt1.pdf
txt2.pdf
txt3.pdf
txt4.pdf
...ect