Detect directory changes in unix
You should use something like FAM, gamin, or inotify to detect when a file has been created, closed, etc.
You could use strace -f myscript
to trace all system calls made by the script, and use grep
to filter the system calls that create new files.