Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8101267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:56:33+00:00 2026-06-05T22:56:33+00:00

I found this question which had an answer to the question of performing batch

  • 0

I found this question 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.

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.


find . -name \*.md -type f -exec pandoc -o {}.txt {} \;

I used the following code to get something of the result I was hoping for:


find . -name \*.html -type f -exec pandoc -o {}.markdown {} \;

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 apps.html, it would convert that file to apps.html.markdown in the same directory as the source files.

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.

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.

Any kind words of wisdom would be deeply appreciated.

TC

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:56:34+00:00Added an answer on June 5, 2026 at 10:56 pm

    Create the following Makefile:

    TXTDIR=sources
    HTMLS=$(wildcard *.html)
    MDS=$(patsubst %.html,$(TXTDIR)/%.markdown, $(HTMLS))
    
    .PHONY : all
    
    all : $(MDS)
    
    $(TXTDIR) :
        mkdir $(TXTDIR)
    
    $(TXTDIR)/%.markdown : %.html $(TXTDIR)
        pandoc -f html -t markdown -s $< -o $@
    

    (Note: The indented lines must begin with a TAB — this may not come through in the above, since markdown usually strips out tabs.)

    Then you just need to type ‘make’, and it will run pandoc on every file with a .html extension in the working directory, producing a markdown version in ‘sources’. An advantage of this method over using ‘find’ is that it will only run pandoc on a file that has changed since it was last run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searched about this question but can't found any suitable answer: I had been
While trying to answer this question I found without () (which invokes C++ most
I found this answer to this question https://stackoverflow.com/a/7244888/1473523 , but in my situation am
This question might appear very simple, but i haven't found an answer yet, so
I found this question which is a great starting point towards creating embedded widgets
I found this on Google, click here , which someone asked a similar question,
I found this question that is discussing what I would like to do, but
I found this question but it was only similar and, more importantly, dated by
I've found this question on StackOverflow Adding div below images in colorbox But it
I am posting this question because I had a complete answer for this written

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.