Here are some issues I found in the bash script:
- The find command should use absolute paths for inputfolderandoutput_folder. Currently it will not work if the script is run from a different directory. It should be:
find "(pwd)/input_folder" -type f -name "*.flac" -print0 | ...
- The xargs command should also use absolute paths for inputfolderandoutput_folder for the same reason. It should be:
xargs -0 -P "(nproc)"−Ish−c′input(pwd)/(pwd)/(pwd)/(pwd)/$output_folder"
- The variables inputfileandoutput_file should be quoted in case they contain spaces. It should be:
input_file="0"outputfile="{output_folder}/'(basename"{input_file%.flac}.m4a")'"
- The ffmpeg command should also quote the inputfileandoutput_file variables. It should be:
ffmpeg -i "inputfile"−output_file"
- It's a good practice to check if $output_folder exists and is writable before running the script. It can be added as:
if [ ! -d "outputfolder"]∣∣[!−w"output_folder" ]; then
echo "Output folder $output_folder does not exist or is not writable."
exit 1
fi
Hope this helps! Let me know if you have any other questions.