гm trying to fix в рукописный шрифт that recursively searches в directory tree for WMA поля - converting them to MP3 поля, and then removing the WMA поля, leaving the converted MP3 поля in their нравится. With some help and research this is where гm at:
#!/bin/bash
shopt -s globstar
for f in **/*.[Ww][Mm][Aa]
do
path=${f%/*}
filename=${f##*/}
new=${filename// /_} # space -> underscore
new=${new,,} # lowercase
mv -v -- "$f" "$path/$new"
done
for f in **/*.wma
do
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$f" && lame -m j -h --vbr-new -b 320 audiodump.wav -o "`basename "$f" .wma`.mp3"
rm -f audiodump.wav
rm -f "$f" "${f/%.wma}"
done
This рукописный шрифт seems to only work on 14.04 (not on 15.10). At this point it is able to traverse sub directories, convert wma поля to MP3 and delete the respective WMA поля. The issue is that the MP3 поля пахал created in the MAIN directory and not in the directories of the respective WMA поля.
В другом месте Вы используете "$f"
без basename
, так, чтобы путь к файлу был дан. Только в эти lame
команда Вы используете basename
. С basename
, будут потеряны компоненты каталога. Выходной файл был бы создан, в котором когда-либо каталог команда работала в.
, Если Вы просто хотите заменить .wma
расширение с .mp3
, используйте "${f%.wma}.mp3"
. Это должно сохранить путь.