Spency
December 13th, 2015, 01:47 AM
Hi all,
I'm a bit of a programming noob and would greatly appreciate anyones input. I'm trying to help a buddy out who has a pretty vast collection of WMA music files, organized into different sub directories of the Music directory. What we want is a script or program that can recursively go through sub folders and convert WMA files to MP3, and then delete the WMA files.
We started off with soundconverter (http://soundconverter.org/) - it froze everytime we tried, and we tried it on 3 different machines 1 14.0.4 and 2 different 15.10 systems. Besides, even if it did work it wouldn't do what we wanted.
Next we hit this page (http://askubuntu.com/questions/55352/convert-library-of-wma-tracks-to-mp3s/55469#55469) and found some code that seemed very promising.
#!/bin/bash
current_directory=$( pwd )
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i && lame -m s audiodump.wav -o $i; done
#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done
The thing is, this doesn't recursively search through sub directories for WMAs to convert, otherwise it does exactly what we want. At a distance, it seems like it would be an easy line of code to get this script to recursively search multiple subdirectories directories. Is anyone willing to help us out?
I'm a bit of a programming noob and would greatly appreciate anyones input. I'm trying to help a buddy out who has a pretty vast collection of WMA music files, organized into different sub directories of the Music directory. What we want is a script or program that can recursively go through sub folders and convert WMA files to MP3, and then delete the WMA files.
We started off with soundconverter (http://soundconverter.org/) - it froze everytime we tried, and we tried it on 3 different machines 1 14.0.4 and 2 different 15.10 systems. Besides, even if it did work it wouldn't do what we wanted.
Next we hit this page (http://askubuntu.com/questions/55352/convert-library-of-wma-tracks-to-mp3s/55469#55469) and found some code that seemed very promising.
#!/bin/bash
current_directory=$( pwd )
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i && lame -m s audiodump.wav -o $i; done
#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done
The thing is, this doesn't recursively search through sub directories for WMAs to convert, otherwise it does exactly what we want. At a distance, it seems like it would be an easy line of code to get this script to recursively search multiple subdirectories directories. Is anyone willing to help us out?