Temp folders are always a pain to empty because some files/folders might be in use by the OS or some other application. You could keep the UDF's in one or more separate files and use call to call them from your main script. That way they are not in your main script but can be used in the same way. They will be stored in the memory of your system.

 Code:
call @scriptdir + "\udf1.kix"
call @scriptdir + "\udf2.kix"
call @scriptdir + "\udf3.kix"

all other code goes here......
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.