Friday, August 29, 2014

Batch Convert Text Files to Different Formats in Terminal

Batch Convert Text Files to Different Formats in Terminal

Converting texts between formats is a bit of a pain to do on a file-by-file basis, but thankfully, MacIssues shows how to convert text files in bulk using a simple terminal command.

The tool you'll use here is textutil, which can convert any single text file into another. Converting one file to another is pretty straight. For example, here's how you'd convert a file to DOCX:

  textutil -convert docx ~/Desktop/mypage.webarchive  

You can do this in bulk by simply pointing to a specific folder. For example, if you wanted to convert a group of text files in a folder on your desktop from TXT to DOCX you'd type this into Terminal:

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

Of course, that's just one of the more basic things textutil can do. You can also use it to bulk change fonts, font sizes, and more.

Convert various text file formats in the OS X Terminal with textutil | MacIssues

No comments:

Post a Comment