We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#!/bin/bash # 定义输入目录和输出目录 input_dir="$1" output_dir="$2" # 遍历目录及子目录中的所有 .flac 文件 find "$input_dir" -type f -iname "*.flac" | while read flac_file do # 获取输入文件的路径和文件名 input_path=$(dirname "$flac_file") input_file=$(basename "$flac_file") # 获取输出文件名 output_file=$(basename "$flac_file" .flac).m4a # 生成输出文件的完整路径,保留原有目录结构 output_path=$(echo "$input_path" | sed "s|$input_dir|$output_dir|")/$output_file # 确保输出目录存在 output_dir_path=$(dirname "$output_path") mkdir -p "$output_dir_path" # 如果输出文件已经存在,则跳过转换操作并输出提示信息 if [ -f "$output_path" ]; then echo "文件 $output_file 已存在,跳过转换" else # 转换文件格式并输出到指定目录 ffmpeg -i "$flac_file" -c:a alac -c:v copy "$output_path" < /dev/null fi done echo "转换完成!"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: