Last active
November 24, 2022 09:54
-
-
Save joeywang/6989371 to your computer and use it in GitHub Desktop.
bash code to detect mp3 download errors
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 - | |
| server='http://assets-server/project' | |
| files=`find . -name '*.mp3'|sed 's/^\.\///g'` | |
| for file in $files | |
| do | |
| result=`curl -s -S -f -m 10 -w '%{content_type}' -H "Cache-Control:no-cache" $server/$file -o /dev/null` | |
| if [ $? -ne 0 ] | |
| then | |
| echo $file | |
| else | |
| if [ "$result" != "audio/mpeg" ] | |
| then | |
| echo $file | |
| fi | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment