|
#!/bin/zsh |
|
|
|
|
|
convert_ogg_to_wav() { |
|
local input_file="$1" |
|
local output_file="${input_file:r}.wav" |
|
ffmpeg -i "$input_file" "$output_file" |
|
echo "Converted: $input_file -> $output_file" |
|
} |
|
|
|
|
|
if [[ $# -eq 0 ]]; then |
|
target_dir="." |
|
else |
|
target_dir="$1" |
|
fi |
|
|
|
|
|
if [[ ! -d "$target_dir" ]]; then |
|
echo "Error: Directory '$target_dir' does not exist." |
|
exit 1 |
|
fi |
|
|
|
|
|
ogg_files=($(find "$target_dir" -type f -name "*.ogg")) |
|
|
|
|
|
if [[ ${#ogg_files[@]} -eq 0 ]]; then |
|
echo "No .ogg files found in '$target_dir' or its subdirectories." |
|
exit 0 |
|
fi |
|
|
|
|
|
for file in "${ogg_files[@]}"; do |
|
convert_ogg_to_wav "$file" |
|
done |
|
|
|
echo "Conversion complete." |
|
|