I am creating what could amount to quite a few temp files on a terminal server using the System.IO.Path.GetTempPath. My question is this. Can I trust Windows to clear that directory on a regular basis or do I need to clear it in code?
Printable View
I am creating what could amount to quite a few temp files on a terminal server using the System.IO.Path.GetTempPath. My question is this. Can I trust Windows to clear that directory on a regular basis or do I need to clear it in code?
Windows will never clear the temp folder. How does the OS know when those files are no longer needed? It's every application's responsibility to clear its own temp files.Quote:
Originally Posted by FastEddie
Oh I always thought Windows did periodic clean up in the temp directory. Now I am not sure how I am going to remove the files after use. My problem is that the user can keep open the file long after the application is closed.
Maybe ApplicationData would be a better location than Temp then.
JMc,
Would you mind explaining your answer a little bit more?
I also have an application that generates files (PDF files in my case) and the user may or may not have the files open when they exit my program.
What can we do with ApplicationData to enable better control over these files? Then, how (when) do we delete files later?
Thanks!