Created
February 14, 2014 18:32
-
-
Save djcp/9006375 to your computer and use it in GitHub Desktop.
Randomly sample files recursively from PWD to test for mime-types
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 | |
COMMAND='RAND=`shuf -n 1 -i 1-100`; | |
if [ $RAND = 1 ]; then | |
if [ -e "{}" ]; then | |
MIME_TYPE=`file -b --mime-type "{}"` | |
echo "$MIME_TYPE\t\t => {}" | |
if [ "$MIME_TYPE" = "" ]; then | |
echo "******************"; | |
echo "{} HAD AN EMPTY MIME TYPE" | |
echo "******************"; | |
fi | |
fi | |
fi' | |
find -type f -print0 | xargs -0 -I '{}' sh -c "$COMMAND" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment