Yes, but since the text-file gets made, and after deleted that wouldn't be a problem, right? What textfile do you wish to add to?
The directory-contents get read everytime you run the script and every file gets checked, so adding to the text-file would not be needed. I think..
I'm sure about not being sure what you mean, could you be more specific?

- Ramon