【问题标题】:How do I convert multiple WAB to OFR including subdirectories?如何将多个 WAB 转换为 OFR,包括子目录?
【发布时间】:2016-08-28 15:29:15
【问题描述】:

我有大约 2,000 个 WAV 文件需要转换为 optimfrog 格式 (OFR)。

我通常对单个目录使用以下命令:

ofr --encode --maximumcompression *.wav

但是,有 2 个主文件夹和数百个子目录。

这将永远手动完成,因此我正在寻找一个自动批处理文件来执行此操作。

我查看了许多示例并尝试了几个,但我不是程序员,正在努力寻找一个工作版本。

在某些时候我需要扭转这个过程并使用:

ofr --decode *.ofr

【问题讨论】:

    标签: batch-file wav subdirectory


    【解决方案1】:

    如何将多个wav 转换为ofr 包括子目录?

    for /r 命令可用于递归访问目录树中的所有目录并执行命令。

    编码.cmd:

    @echo off
    rem start in the current directory (the top of the tree to visit) and loop though each directory
    for /r %%a in (.) do (
      rem enter the directory
      pushd %%a
      rem perform the required command.
      ofr --encode --maximumcompression *.wav 
      rem leave the directory
      popd
      )
    

    解码.cmd:

    @echo off
    rem start in the current directory (the top of the tree to visit) and loop though each directory
    for /r %%a in (.) do (
      rem enter the directory
      pushd %%a
      rem perform the required command.
      ofr --decode *.ofr 
      rem leave the directory
      popd
      )
    

    延伸阅读:

    • for /r - 循环文件(递归子文件夹)。
    • pushd - 更改当前目录/文件夹并存储以前的文件夹/路径以供 POPD 命令使用。
    • popd - 将目录改回 PUSHD 命令最近存储的路径/文件夹。

    【讨论】:

    • 对不起,只是没有关注你。 Root 的目录是 D:\Black Mesa。有2个子目录,1个是hl2,另一个是BMS。在这些里面是每个文件夹中的几十个子目录。你能给我一个外行的布局吗???非常非常感谢
    • @SteveRobathan 你到底没有关注什么?在D:\Black Mesa 中创建Encode.cmd,打开cmd 提示。 cd /d D:\Black Mesa,运行Encode.cmd
    • @SteveRobathan for 循环遍历目录树,从顶部开始依次访问每个子目录。当它访问时,它运行ofr。所以ofr 命令在每个子目录中运行。
    • 我得到 OFR 未被识别为内部或外部命令,即使它存在于刚刚创建的 Encode.cmd 中
    • @SteveRobathan 将D:\Black Mesa 添加到您的PATH 或编辑encode.cmd 并将ocr 替换为D:\Black Mesa\ocr。
    猜你喜欢
    • 2021-05-21
    • 1970-01-01
    • 2014-04-29
    • 1970-01-01
    • 2022-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多