Last active
July 7, 2017 23:53
-
-
Save davidhuser/f468a517cd5e1c2c024fa05d6ef66d6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Flac to MP3 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 -cds "$fn" | lame -q 0 -b 320 --silent - "${fn%.*}".mp3; 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 -cds "$fn" | lame -q 0 -b 320 --silent - "${fn%.*}".mp3 ; 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