Tuesday, August 31, 2010

So there I was...

I had a few PDFs on-hand that I wanted to back up but save on my local machine as text files. There are a number of ways to do this, but the easiest (and cheapest) way was to get Xpdf from here. One utility program included with Xpdf is pdftotext. I then had to figure out a way to use pdftotext to convert my files in one big batch. Here's what I did. First, I dragged all 575 of the desired files to the directory where pdftotext.exe was located. Next, I used the command prompt (under Vista, Start->Run->cmd) dir to make a list of all the PDF files in the directory (dir *.pdf /b > list). As for batching the file conversion, I then used the FOR command included with the cmd program. Here's the applicable syntax:

for /F %i in (list) DO pdftotext %i

Worked like a champ! The files I converted were mostly text, so they were fairly conducive to conversion. Besides, this freed up about 60 MB on my hard drive. Not a lot by today's standards, but I can keep a few more pictures or MP3s now...

No comments: