I currently have a big big directory filled with many sub-directories with identically named markdown files in each:
/big-directory/sub-directory-name-1/sub-directory-name-1.md
/big-directory/sub-directory-name-2/sub-directory-name-2.md
/big-directory/sub-directory-name-3/sub-directory-name-3.md
I would like to end up with this:
/big-directory/sub-directory-name-1/sub-directory-name-1.md
/big-directory/sub-directory-name-1/index.html
/big-directory/sub-directory-name-2/sub-directory-name-2.md
/big-directory/sub-directory-name-1/index.html
/big-directory/sub-directory-name-3/sub-directory-name-3.md
/big-directory/sub-directory-name-1/index.html
I’m trying to write a shell script on OS X that will run multimarkdown on each file, but I’m having difficulty figuring out how to make the loop run over the subdirectories without manually putting them all into the script. Thanks in advance for any help.
To get a list of all the leaf directories below /big-directory, you can use the answer in this question.
Then, you can construct a while loop like this:
That should give you a starting point.