Sometimes I'd the necessity to convert Wavpack files to Flac: generally I use files with embedded cuesheet, so my goal was to convert the files exactly in the same way. Please note that I've used, to simplify programming, rpl, that is a package generally present in the repositories. Of course, I need also wavpack and flac installed...
All the two formats have advantages and less good aspects, so be careful before choosing to convert a massive collection.
Be also careful to make a test before using this script, I would cry with you if you will loose data, but probably you will be unhappy with this.
#!/bin/bash
sdir=`pwd`
#*
find "$sdir" -maxdepth 1 -type f -iname "*.wv" | \
while read file
do
disco=`basename "$file"`
disco=${disco%\.*}
cuefile="$disco"".cue"
imagefile="$disco"".wav"
wvunpack -cc "$disco"".wv" -o "$imagefile"
rpl "CDImage.wav" "$disco"".flac" "$cuefile"
flac -8 --replay-gain -f "$imagefile"
metaflac --remove-all "$disco"".flac"
metaflac --add-replay-gain --import-cuesheet-from="$cuefile" --set-tag-from-file=CUESHEET="$cuefile" "$disco"".flac"
rm "$cuefile"
rm "$imagefile"
if [ -f "$disco"".flac" ]; then
rm "$file"
fi
done