Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[find-binary-files-in-git-repo.sh] Find binary files in a git repo #git #bash
#!/bin/bash
git_files=$(git ls-files)
for git_file in $git_files; do
encoding=$(file --mime-encoding "$git_file")
type=$(echo "$encoding" | awk -F ': ' '{ print $2 }')
if [ "$type" == "binary" ]; then
echo $git_file
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment