Skip to content

Instantly share code, notes, and snippets.

@flagranterror
Created July 28, 2012 23:42
Show Gist options
  • Save flagranterror/3195292 to your computer and use it in GitHub Desktop.
Save flagranterror/3195292 to your computer and use it in GitHub Desktop.
Color files in finder based on clamscan results.
#!/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