Created
July 28, 2012 23:42
-
-
Save flagranterror/3195292 to your computer and use it in GitHub Desktop.
Color files in finder based on clamscan results.
This file contains 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/sh | |
clamscan="/usr/local/bin/clamscan" | |
file=$1 | |
if [ -z "$clamscan" ] | |
then | |
echo "Add clamav to your \$PATH or set \$clamscan, dawg." | |
exit 1 | |
fi | |
$clamscan "$file" > /dev/null 2>&1 | |
if [ $? -ne 0 ] | |
then | |
color=2 | |
else | |
color=6 | |
fi | |
#echo "color $color" | |
osascript -e "tell application \"Finder\" to set label index of item (POSIX file \"$file\") to $color" > /dev/null 2>&1 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment