Last active
July 15, 2017 16:14
-
-
Save davidhuser/6fafe9bef79126451190e63af2a8dd00 to your computer and use it in GitHub Desktop.
Flac to WAV, recursive, unpacking ZIPs
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 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