OS是否删除%TEMP%目录中的临时文件? [英] Is OS delete temporary file in %TEMP% directory?

查看:75
本文介绍了OS是否删除%TEMP%目录中的临时文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

我正在开发一个Windows应用程序。

I am developing a windows application.

我对临时目录有疑问。

如果我使用Path.GetTempPath()方法,我可以获得临时目录路径。

If I use Path.GetTempPath() method, I can get temporary directory path.

我想在这里保存一些临时文件。

I want to save some temporary files here.

我的问题是,我应该定期清除这些文件吗?

My question is, should I clear this files regularly?

或者OS是否定期清除文件?

Or does OS clear files regularly?

谢谢。

推荐答案

Windows不会自动清除位于Path.GetTempPath()返回的路径中的任何文件(例如,%TEMP%,%TMP%等)  您的程序可以在使用它们时删除它在这些位置创建的文件。 运行Windows磁盘清理时,用户也可以删除存储在这些位置
中的文件。
Windows does not automatically clear any files located in the path returned by Path.GetTempPath() (e.g., %TEMP%, %TMP%, etc.).  Your program can delete files it creates in such locations when it is done using them.  Files stored in those locations can also be deleted by a user when running Windows' disk cleanup.


这篇关于OS是否删除%TEMP%目录中的临时文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆