Saturday, November 3, 2012

Howto Convert PDF to TXT in Ubuntu Linux

TO CONVERT ALL PDFs to TEXT  with THE SAME NAME NO MATTER SPACES IN NAME  :


find . -name '*.pdf' -print0 | xargs -0 -n1 pdftotext




this command seems to work when sometimes the other does not, but it has the problem of converting ALL pdfs within the folder `A` in which it is fired, downwards to those possibly present  in `A/B/C/D`... and so forth: if that is fired in the home folder, all your pdfs will be converted to txt

to avoid this:



ls *.pdf | xargs -n1 pdftotext
(The -n1 option makes sure that only one pdf file is passed to pdftotext at a time. But this command is allergic to space in names.)

In order not to wary about spaces in filenames:

for file in *.pdf; do pdftotext "$file" "$file.txt"; done


These commands can be added in Thunar as custom actions
(the source for all this info is in the answers to this question)

 

No comments:

Post a Comment