Skip to content

Instantly share code, notes, and snippets.

@joeywang
Last active November 24, 2022 09:54
Show Gist options
  • Select an option

  • Save joeywang/6989371 to your computer and use it in GitHub Desktop.

Select an option

Save joeywang/6989371 to your computer and use it in GitHub Desktop.
bash code to detect mp3 download errors
#!/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