Lets suppose I have files on my harddisk having extensions as .md. I want to convert all those files to .html through find and the -exec option.The command to convert a markdown file to html ismarkdown readme.md > readme.htmlI am trying to use something like: find / -name *.md -type f -exec markdown {} > {}.html \;Of course, the above doesn't work. So, how do I do that using only find and exec?
Use find command to convert markdown files to html
bash;find
You need to quote around the construct containing > because it's a shell special character, like this:find / -name *.md -type f -exec sh -c 'markdown $0 > $0.html' {} \;This will also rename the files so you end up with foo.html instead of foo.md.html:find / -name *.md -type f -exec sh -c 'markdown ${0} > ${0%.md}.html' {} \;