koha-to-dspace/docx-to-pdf.sh

12 lines
342 B
Bash

#!/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