printf "%s\n" "${0##*/}"
${0##*/} takes the path $0 and strips off any leading directory names, leaving only the file name. The printf command adds a newline to the end and then this file name is piped to...
| sha1sum | cut -d" " -f1
This computes the SHA-1 hash of the file name and then uses cut to extract just the hash from sha1sum's output.
${0%/*}
This is the opposite of ${0##*/}—this one gets the directories from $0 and throws away the file name.
So effectively, what ends up getting run is:
mv "$DIR/$FILENAME" "$DIR/$HASH_OF_FILENAME"
In English, it renames every file it finds to the SHA-1 hash of the original file name.
For what it's worth, it could be simplified a bit and made more readable. I might write the mv command as:
mv "$0" "$(dirname "$0")/$(basename "$0" | sha1sum | awk "{print \$1}")