如何将多个 WAB 转换为 OFR(包括子目录)?

How do I convert multiple WAB to OFR including subdirectories?

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

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

ofr --encode --maximumcompression *.wav

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

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

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

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

ofr --decode *.ofr

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

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

Encode.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
  )

Decode.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 - 更改当前的 directory/folder 并存储之前的 folder/path 以供 POPD 命令使用。
  • popd - 将目录更改回 path/folder 最近由 PUSHD 命令存储的目录。