Mac 內建 textutil 強大文件格式轉換工具,支援 docx↔doc、rtf、html、txt 等互轉,無需安裝 Office/LibreOffice:
textutil -convert doc /path/to/file.docx
輸出檔同目錄下產生 file.doc。路徑含空格請加引號,或直接拖曳檔案到終端機自動填入路徑。
cd /path/to/folder
textutil -convert doc *.docx
| 參數 | 說明 |
|---|---|
-convert fmt | 目標格式:doc, docx, rtf, rtfd, html, txt, webarchive, odt, wordml |
-output file | 指定輸出檔名/路徑 (單檔時) |
-encoding | 指定編碼 (如 UTF-8) |
-font/-fontsize | 轉 txt/rtf 時指定字體/大小 |
