#!/bin/bash

DIRECTORY_1="/home/ftptr143"
DIRECTORY_2="/var/www/tr143/upload"

inotifywait -m -r -e create --format '%w%f' "$DIRECTORY_1" "$DIRECTORY_2" | while read NEW_FILE
do
    echo "New file detected: $NEW_FILE"
    rm "$NEW_FILE"
    echo "File deleted: $NEW_FILE"
done
