批处理pandoc转换 [英] batch processing pandoc conversions
问题描述
抱歉或太厚.我搜寻了很多内容,以尝试找出如何批处理 pandoc .我无法终生解决.
Sorry or being thick. I've searched high and low to try and work out how to batch process pandoc. I cannot for the life of me work it out.
如何将包含html文件的文件夹和嵌套文件夹转换为markdown?
How do I convert a folder and nested folders containing html files to markdown?
我应该提到我正在使用os x 10.6.8
I should mention that I'm using os x 10.6.8
推荐答案
您可以使用find
在目录树中的文件上应用任何命令:
You can apply any command across the files in a directory tree using find
:
find . -name \*.md -type f -exec pandoc -o {}.txt {} \;
将在所有后缀为.md
的文件上运行pandoc
,从而创建后缀为.md
的.txt
后缀,或者要用子shell调用做一些丑陋的事情,则需要一个包装器脚本.){}
从-exec
到终止\;
的任何词都将是替换为文件名.
would run pandoc
on all files with a .md
suffix, creating a file with a .md.txt
suffix. (You will need a wrapper script if you want to get a .txt
suffix without the .md
, or do ugly things with subshell invocations.) {}
in any word from -exec
to the terminating \;
will be replaced by the filename.
这篇关于批处理pandoc转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!