Skip to content

Instantly share code, notes, and snippets.

@davidhuser
Last active July 15, 2017 16:14
Show Gist options
  • Save davidhuser/6fafe9bef79126451190e63af2a8dd00 to your computer and use it in GitHub Desktop.
Save davidhuser/6fafe9bef79126451190e63af2a8dd00 to your computer and use it in GitHub Desktop.
Flac to WAV, recursive, unpacking ZIPs
#!/bin/bash
# Flac to WAV with option recursive, unpack zips first
echo "$PWD"
read -rp "Recursive? y/n - " recursive
for f in $(find . -type f -name '*.zip')
do
unzip -n "$f"
done;
case "$recursive" in
y) find . -type f -name '*.flac' | while read fn; do
echo "$fn"
if flac -ds "$fn" ; then
rm -fv "${fn}"
fi
done;
;;
n) NO=$(ls -1q *.flac | wc -l)
if [[ $NO -ge 1 ]]
then
for fn in *.flac; do
if [[ -f "$fn" ]]; then
echo "$fn"
if flac -ds "$fn" ; then
rm -fv "${fn}"
fi
fi
done
fi
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment