Libreoffice: convert a dir with 3247 *.odt files in 1171 folders to *.pdf
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
It is very simple. This is the command line command:
Code:
libreoffice --headless --convert-to pdf *.odt
I use LO 4.3.3. OO or LO has the habit to change their GUI interface and CLI in the most surprising ways, not upward compatible and badly documented. But at least now you know what to search for.
Some person smarter than me might be able to enter this command right in the -exec part of the find command. But find is quite picky when it comes to the syntax of the -exec command. So I could not and did not have the time. It works with this separate bash file.
for file in *.odt
do
mv "$file" "${file%.odt}.pdf"
done
should do it. But take that with a grain of salt I'm no expert
This was without a doubt the worst thing I have seen in this forum for a while. Changing an extension does not change a word processing file to an Adobe pdf. You need LibreOffice to export the pdf.
Quote:
I tested this on some files and it seems to have worked as expected. However, it does not work recursively through directories.
You mean it changes the file extension as expected.
Quote:
EDIT: Scratch that. While my file manager showed it as pdf, running
Code:
file testfile
still showed it as an OpenDocument Text file
No kidding. So changing the extension of a file does not change its contents. Shocking. Why do you post on this forum ?
The -r is not needed for the rm at all. See "man rm".
In fact if you also check the manual page for find you might decide that the -delete option is more appropriate than trying for an -exec option. See "man find" and browse down to -delete
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.