Warung Online

Kamis, 20 Februari 2014

How to Batch Convert DOCX Files to TXT Format with textutil in OS X osxdailynews.blogspot.com

Written By Unknown; About: How to Batch Convert DOCX Files to TXT Format with textutil in OS X osxdailynews.blogspot.com on Kamis, 20 Februari 2014

osxdailynews.blogspot.com ® How to Batch Convert DOCX Files to TXT Format with textutil in OS X

Batch convert docx to txt or rtf


The Mac includes a fantastic command line tool called textutil which allows for quick text file format conversions, translating almost any text or word document type into another. We’ve discussed textutil for a variety of uses, but typically it has been for one-off conversions of a specific file into a new file type. This time around we’ll focus on batch converting a group of files that are in the common Microsoft Office “DOCX” format, which is basically a compressed XML version of a classic Office DOC file, into a simple TXT or RTF file format, which has greater compatibility.


Because textutil is a command line tool, users should be somewhat comfortable using the terminal before diving in, this is reflected in the first examples shown for those who know the command line well enough. If you’re new, though we will try to make it easy enough that almost anyone at any skill level with OS X should be able to follow along.


Batch Converting DOCX to TXT / RTF with textutil


For those who are adept at using the command line, the syntax necessary for batch docx to txt or rtf file conversion is as follows:


Batch converting docx files to txt with textutil


Convert DOCX to TXT:


textutil -convert txt /path/to/DOCX/files/*.docx


Convert .docx to .rtf :


textutil -convert rtf /path/to/docx/files/*.docx


The “-convert txt” or “-convert rtf” flag tells textutil to convert the files into the given format, and the rest of the command string is simply a path to the files in question. Then, a wildcard * is used with the .docx file extension to tell textutil to convert everything in that specified directory.


The freshly converted rtf or txt files will appear in the same directory as the original .docx files, the original dock files will not be overwritten or modified. That’s it, you’re all done. Obviously the txt file format is more universally readable than rtf, but RTF files maintain some formatting better than txt. Use whichever is necessary, or depending on the complexity of the docx files in question.


Batch Converting DOCX to TXT for Mac Terminal Newbies


If the above was over your head, don’t worry, you can make the process a bit easier by using a combination of the Finder and the Terminal, thanks to the print full path trick:



  1. Navigate in the Finder file system to the directory where the docx files are located which need to be converted, or drag the docx containing folder to the desktop

  2. Open the Terminal application, found in /Applications/Utilities/

  3. Type the following command syntax, adding a space at the end of ‘txt’, but don’t hit return yet:

    textutil -convert txt



  4. Go back to the Finder, now drag & drop the docx containing folder into the terminal window to print out the full directory path into the terminal

  5. Add at the end of the directory path “*.docx” without the quotes, the resulting command string at the terminal prompt should look something like this:

    textutil -convert txt ~/Desktop/MyDocxFiles/*.docx



  6. Hit return to complete the batch conversion


The new .txt files will appear almost instantly in the same folder as the original .docx files, they even have the same file name with the exception of the new file format extension. If you can’t tell the old file from the new files apart, be sure you have file format extensions set to visible in the Mac Finder to easily show the difference.


Batch converted docx to txt files in a Mac folder


Thanks to James Harvard for the tip idea.


Email this How to Batch Convert DOCX Files to TXT Format with textutil in OS X to a Friend! Receive Articles like this one direct to your email box! Subscribe for free today!

Tidak ada komentar:

Posting Komentar