4

I'm running the current version of Sierra (10.12.5). The documents appear in Finder without extensions and the system has given them exe icons despite categorizing them as Documents. They are unviewable with QuickLook and mdls identifies their type as CWWP.

LibreOffice is able to open the documents without all the weird crud and formatting issues that appear when opening them with other applications [Word/TextEdit/Atom/OpenOffice/Etc.]. And the "soffice --headless" commandline tool allows one to attack entire directories. Great. But I can't find an option to retain the original Date/Time Created stamps to the converted files.

I did find some freeware that will convert old WordPerfect docs to modern formats, but it doesn't work with my ClarisWorks docs.

I attempted to use the app DocumentConverter, but it crashes every time I try to export anything.

I've, also, attempted to use unoconv in conjunction with LibreOffice but have slammed against the brick wall of an unfixed bug from 2012.

Additionally, I found this bash script, which purports to do exactly what I need. However, in practice, the batch function doesn't work and the script has no setting to retain the original Date/Time stamps.

What I'm hoping to find is a simple commandline tool that I can aim at entire folders of these documents to convert in place, with the ability to retain the Date/Time Created stamps.

What are my best options?

Thanks.


08.05.17 - EDIT:

I'd like to thank @patrix for his bash script. It should come in very handy.

& I'd like to let anyone who has come across this while searching for a solution know that the developer of the libmwaw library (& associated tools) very nicely updated the source and his mwawOSX app to enable created date/time inheritance for converted ClarisWorks files.

  • Write an automator script or search to see if one exists already that you can edit. As for keeping the original dates what has happened to the ones you tested with saveas? A possible option . jamf.com/jamf-nation/discussions/7434/batch-convert-cwk-to-docx – Solar Mike Jul 13 '17 at 5:11
  • LibreOffice doesn't install any default Automator Actions so I can't build a service for it. Saving the documents in LibreOffice saves them as brand new documents with the current date/time. The scripts you link to require the version of Pages in iWork '09 in order to function. – Kerlix Jul 13 '17 at 7:11
  • Amending the bash script to backdate the created files is doable, actually – nohillside Jul 13 '17 at 11:13
  • @patrix Great! How do I do that? – Kerlix Jul 13 '17 at 22:16
  • apple.stackexchange.com/a/222459/9058 should point you to the right commands. If this is too much shellscript magic for your taste I can post a script sometime this weekend. Just let me know – nohillside Jul 14 '17 at 5:03
5

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .