【问题标题】:Convert all .docx in directory and subdirectories (recursive?) to .md using Pandoc bash使用 Pandoc bash 将目录和子目录(递归?)中的所有 .docx 转换为 .md
【发布时间】:2016-11-01 01:47:07
【问题描述】:

我希望 Pandoc 将目录中的所有 .docx 文件转换为 .md。

这个目录有很多子目录,还有子子目录等

我希望输出 .md 文件与转换它的 .docx 文件位于同一目录(和子目录等)中。

我尝试了this的许多变体:

find ./ -iname "*.docx" -type f -exec sh -c 'pandoc "${0}" -o "./output/$(basename ${0%.docx}.md)"' {} \;

我知道命令的“./output/”部分指定将转换后的文件放在一个名为“output”的目录中

当我从命令中删除“./output/”时,输出的 .md 文件都放在运行命令的顶级目录中。我希望这些输出文件“留在”他们的 .docx 文件所在的目录中。

我正在使用带有 Cygwin 的 Windows 8。如果答案需要代码(makefile?),我希望语言是 Lisp(显然,我不是程序员)。

我该怎么做?

【问题讨论】:

    标签: bash pandoc


    【解决方案1】:

    基于:Converting all files in a folder to md using pandoc on Mac

    我认为应该是:

    find ./ -iname "*.docx" -type f -exec sh -c 'pandoc "${0}" -o "${0%.docx}.md"' {} \;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-19
      • 1970-01-01
      • 2016-10-23
      相关资源
      最近更新 更多