title: Recursive directory parsing with Pandoc on Mac
body: <p><a href="https://stackoverflow.com/a/10323583/1026064">I found this question</a> which had an answer to the question of performing batch conversions with Pandoc, but it doesn't answer the question of how to make it recursive. I stipulate up front that I'm not a programmer, so I'm seeking some help on this here. </p>
  
  <p>The Pandoc documentation is slim on details regarding passing batches of files to the executable, and based on the script it looks like Pandoc itself is not capable of parsing more than a single file at a time. The script below works just fine in Mac OS X, but only processes the files in the local directory and outputs the results in the same place. </p>
  
  <p><code>
  find . -name \*.md -type f -exec pandoc -o {}.txt {} \;
  </code></p>
  
  <p>I used the following code to get something of the result I was hoping for:</p>
  
  <p><code>
  find . -name \*.html -type f -exec pandoc -o {}.markdown {} \;
  </code></p>
  
  <p>This simple script, run using Pandoc installed on Mac OS X 10.7.4 converts all matching files in the directory I run it in to markdown and saves them in the same directory. For example, if I had a file named <strong>apps.html</strong>, it would convert that file to <strong>apps.html.markdown</strong> in the same directory as the source files. </p>
  
  <p>While I'm pleased that it makes the conversion, and it's fast, I need it to process all files located in one directory and put the markdown versions in a set of mirrored directories for editing. Ultimately, these directories are in Github repositories. One branch is for editing while another branch is for production/publishing. In addition, this simple script is retaining the original extension and appending the new extension to it. If I convert back again, it will add the HTML extension after the markdown extension, and the file size would just grow and grow. </p>
  
  <p>Technically, all I need to do is be able to parse one branches directory and sync it with the production one, then when all changed, removed, and new content is verified correct, I can run commits to publish the changes. It looks like the Find command can handle all of this, but I just have no clue as to how to properly configure it, even after reading the Mac OS X and Ubuntu man pages. </p>
  
  <p>Any kind words of wisdom would be deeply appreciated. </p>
  
  <p>TC</p>