Does the temporary file duration persist?

I am working on a program that will generate some temporary files, wait for the user to enter several things, and then use these temporary files for the operation.

I was wondering if I can reliably expect these temporary files to not disappear before I finish them completely (for example, will they disappear while the user is working?).

Obviously, I could create my own folder in my applications and use it for temporary files. But it would be easier to use C # Path.GetTempFileName()or Path.GetTempPath() + somename. When will files created this way be deleted?

To clarify, I am not looking for how to create temporary files, but rather how long the temporary files created in are stored GetTempPath(), and whether it will be long enough to wait for user input before using them.

+3
source share
5 answers

I am not aware of any process in Windows that automatically deletes temporary files. The user may have a cleanup task, but you can reasonably expect your files to be left one for one day or two at least.

, Outlook . , .

+2

, 100% - , , .

GetTempPath() . PATH. - .

+2

. , XP , 1- . , Vista/7, , % TMP% .

+2
+2

, , (, Disk Clean ).

, , , temp .

+1

Source: https://habr.com/ru/post/1752647/


All Articles