#!/bin/sh
OLDFILE="/usr/scripts/var/copyrighted-content.old"
NEWFILE="/usr/scripts/var/copyrighted-content.new"
EXTS="\(avi\|flv\|mkv\|mp3\|mp4\|nzb\|pdf\|rar\|srt\|wmv\|zip\|iso\|bin\|cue\)"

mv "$NEWFILE" "$OLDFILE"

touch "$NEWFILE"
chmod 600 "$NEWFILE"
chown root:root "$NEWFILE"

find /home-adh/ -ignore_readdir_race -type f -regex ".*\.$EXTS" | sort >> $NEWFILE

diff -U 0 "$OLDFILE" "$NEWFILE" | mail -s "Detection des fichiers potentiellement copyrightes" bureau@lists.crans.org
