Quite a while ago I mentioned how you can convert Windows Docx files to Doc using a little app supplied by Microsoft themselves, its a simple way of saving money and not having to fork out for Office for Mac. That app is great for one or two files that you want to convert, however if you have hundreds of files or want to build this functionality into a bash script it can be a little bit difficult. However there is a suitable Terminal program that you can use. This script piggy backs on the functionality built into TextEdit, so any results you get from TextEdit you will see in this Terminal program.
The function we are going to use is textutil. As you may guess by the name it is a text utility. The program has many functions and you can find out how to use them all by reading the man page (in Terminal type ‘man textutil’), i’m going to focus, however, on the conversion aspect of the program. In this example I am going to convert a docx file to a doc file. In total you can use any of these format txt, rtf, rtfd, html, doc, docx, odt, wordml, or webarchive.
To convert a file type the following in Terminal:
textutil -convert doc /path/to/my/file.docx
This will convert the file from docx to doc. The result will be exactly the same if you used TextEdit to open the file and save it out. For example i’ve found any docx images won’t appear in the final doc format, if you want the images its better to use the little app supplied by Microsoft. Simply change ‘doc’ into the format you are looking for. If you don’t think it will work, try the file extension and see what happens.
If you want to convert all of the files in a folder to one format you can type
textutil -convert doc /path/to/location/*.docx
This will convert every file in the folder with .docx as the the file type into the doc format. This is a very quick way of converting lots of files.
There is a lot of power with this tool. If you want to learn more about the program, use the man page as mentioned, if you have a cool little tip about this function please leave a comment below.