I’m making an attempt to recursively discover all docx information in a folder (with subfolders) and convert them to pdf utilizing a headless LibreOffice occasion. I would just like the output file to be saved in the identical folder because the enter file. Sadly, the output file is all the time saved within the present listing.
How can I save the output file in the identical listing wherein the enter file was positioned?
Listed below are the instructions that I’ve tried:
discover . -type f -name '*.docx' -print -exec sh -c '/Purposes/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf "{}"' ;
I believed it would work by utilizing the --outdir choice however the information nonetheless get saved within the present working listing.
discover . -type f -name '*.docx' -print -exec sh -c '/Purposes/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf --outdir . "{}"' ;
