Batch convert RTF files to TXT

Last year I decided to use plain text files (TXT) as the main file type for all my computer text input. There are several reasons for this, but perhaps the most important one was all the problems experienced when trying to open other types of text-based files (RTF, DOC, etc.) on various iOS and Android devices that I use daily. Another reason is to become independent of specific software solutions, forcing you to use a specific software for something as basic as writing text on your computer or device. Along the way I decided to shift my note-taking from MacJournal to nvALT. The best thing about nvALT is that it can unobtrusively monitor a folder of text files, and it allows for quickly searching in old files and write new ones. Since all the files are just plain text files stored in a regular folder (and sync’ed to the cloud), I can of course also use any text editor to view and write the files.

The problem was how to get all my previous notes into my new “system”. I have used a number of different note taking software over the years (e.g. Journler, DevonThink and Evernote). Fortunately, I have been quite careful about exporting all the notes regularly, mainly as RTF files. Having a few thousand such files (and some others), I looked for a solution to quickly convert them to plain text files. There are more complex solutions for converting text files to various formats (e.g. Pandoc), but I found the easiest solution was to use the OSX command line utility textutil. This little line will convert all RTF files in a folder to TXT files:

find . -name \*.rtf -print0 | xargs -0 textutil -convert txt

It will (of course) remove any formatting, but it will preserve all the (text) content nicely.

Published by

alexarje

Alexander Refsum Jensenius is a music researcher and research musician living in Oslo, Norway.

2 thoughts on “Batch convert RTF files to TXT”

  1. This sounds like a great help but I have a few questions. What is that bar before the xargs? I tried the shift version of the \ key but got an error.

    Also, do you know if I can execute this command from my VB6 application? It creates an rtf but the user needs a txt.

    Thank you!

Comments are closed.