How Do I Batch Convert Hundreds of ClarisWorks Documents to a Modern Format?

Solution 1:

Taking most of the relevant stuff from the bash script you've linked to and adding some commands to copy the timestamp from the original file to the newly created one will give you

#!/bin/bash

SOFFICE="/Applications/LibreOffice.app/Contents/MacOS/soffice"

[[ -x "$SOFFICE" ]] || exit 1
[[ -r "$1" ]] || exit 2

$SOFFICE --headless --convert-to docx:"MS Word 2007 XML" "$1"

ts=$(stat -f "%Sm" -t "%Y%m%d%H%M.%S" "$1")
docx=$(basename "$1" .cwk).docx
touch -t $ts "$docx"

This will convert one file (passed as an argument, including a path if applicable) from cwk into docx, store the docx in the current directory (which may be different from the place of the source file) and apply the "last modified" date from the original file to the converted one.