Are files in the temporary folder automatically deleted?

前端 未结 4 1407
我寻月下人不归
我寻月下人不归 2020-12-11 15:01

If I create some file using Path.GetTempPath() - does it automatically get deleted at some stage, or is it up to me to delete it?

4条回答
  •  轮回少年
    2020-12-11 15:22

    Basically if your application does not delete a file it will still be there until your application removes it and you should manage files your app creates based on that idea.

    That said, once the file is closed you must always allow for the fact that it may not be there next time you want it and that you may need to recreate it. For example, Windows has a "disk cleanup tool" which may be run when space gets low, when directed by a user, or on a schedule...

提交回复
热议问题