我目前正在尝试编写一个小脚本来将所有 flac 文件转换为 mp3 文件。然而,当我尝试在所有音乐文件夹中设置递归时,我遇到了一些问题 - 脚本不断循环到当前目录 (.)
这是我目前拥有的:
#!/bin/bash
#---
# flacToMp3: Converts FLAC files in my originalFLAC folder into mp3 files
# and places them in an identical folder structure in my Music
# folder.
#---
function enterDIR {
for DIR in "$(find . -maxdepth 1 -type d)"; do #recurse into every directory below top-level directory
if [ "$DIR" == "." ]; then #avoid current directory infinite loop
continue
fi
cd "$DIR/"
enterDIR
done
createDirectory
convertFLAC
}
function …Run Code Online (Sandbox Code Playgroud)