My examples will include paths for LibreOffice on a Mac, so make sure to adjust accordingly.
The following will convert all Word documents on my desktop to PDFs in the
convert folder on my Desktop:
HOME=/tmp TMPDIR=/tmp /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf:writer_pdf_Export --outdir /Users/jon/Desktop/output/ /Users/jon/Desktop/*.doc
Make sure to include
HOME=/tmp TMPDIR=/tmp before the command or it will run into permission issues and be unable to complete the file conversion.
Some believe writing files to the
/tmp directory is a better approach, but I didn’t end up trying it myself.