According to the lame man page, this is the syntax:
lame [options] <infile> <outfile>
Apparently you can't use a wildcard as you did in
Quote:
lame -a -h -p -b 96 /audio/*.wav /audio/$DATE.mp3
|
so lame ignores that command, and then you get to
rm is perfectly happy with wildcards so on the first loop it deletes all the wav files in the /audio directory.
Instead, before the loop, move the old mp3s to the archive directory. Use your code
Quote:
#Copy old MP3's into an archive directory, then deletes
mv /audio/*.mp3 /audio/archive
|
Then step through the /audio directory one file at a time, something like:
Quote:
cd /audio
for W_file in *
do
if [[ $W_file == *.wav ]]
then
#Encodes wav file into MP3
lame -a -h -p -b 96 $W_file /audio/$W_file$DATE.mp3
#Deletes old wav file
rm $W_file
fi
done
|
PS: if you use $DATE.mp3 for <outfile>, you'll just keep overwriting lame's output & end up with only 1 mp3 for the day.