It might be possible to use (something like) chmod 0nnn, <path/*>; to set the files read-only--see your local man pages for the correct values of nnn to use--to whatever group/userid the process that is deleting them runs as, and then reset the permissions once you've processed them. However, that would probably mean that you would have to delete them in your code and could cause errors in the other process.
You might also get away with creating a symbolic link (terminology?) to reference them (using a system utility?) that would keep data around until you deleted the link.
I'm really out of my knowledge base on *nix, assuming that is your OS, so take this with a big pinch of salt, but the ideas may be useful.
UpdateAnd didn't I prove it! I completely missed any association between the PROC arg to readdir and anything to do with the system process list. D'oh!
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.