Ubuntu, torrents and anti-virus trick

There are probably a lot of ways to scan downloaded files after completion in Ubuntu.
I run an old P4 download server with Ubuntu, and I want to scan my downloads for virusses before I use them on a Windows machine.
I installed Avast, which has command line access to the scanner.
I use Deluge (for its great WebUi) and for some reason the “execute on completion” plugin did not work.

In my case, Deluge moves completed downloads to “/storage”

Here’s my solution: I installed dnotify and use it to trigger Avast.

dnotify -C /storage -r -e avast -p=1 /storage

…will trigger a scan of the folder, right after a file has been created.
-C is to trigger an event on file creation
-r is for recursive monitoring
-e is the command that needs to be executed
“avast -p=1 /storage” is to run an Avast virus scan.
Warning: the “-p=1” option deletes infected files without warning.

You can replace the directory “/storage” with your own.

I know, the method is rude – but it works like a charm.