From 85d3c5ed4232e274c082e4ebb3d5b20482ecc0de Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Sun, 23 Jul 2023 14:45:03 +0200 Subject: [PATCH] Add docx-to-pdf.sh (convert and update contents file) --- docx-to-pdf.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docx-to-pdf.sh diff --git a/docx-to-pdf.sh b/docx-to-pdf.sh new file mode 100644 index 0000000..1fce4e5 --- /dev/null +++ b/docx-to-pdf.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +initialPath=$(pwd) +find . -type f -name '*.doc*' | sed -r 's|/[^/]+$||' | sort -u | while read dir; do + cd "$dir" + find . -type f -name '*.doc*' | while read file; do + soffice --headless --convert-to pdf "$file" + echo "$file" | sed -e 's|^\./||' | sed 's/docx?/pdf/' | tee -a contents + done + cd "$initialPath" +done