删除后,使用临时文件 [英] Deleting Temporary Files after usage

查看:188
本文介绍了删除后,使用临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些临时文件的工作在我的Windows窗体.NET 3.5应用程序。这些文件中,可以当然运行更长的时间比我自己的程序的外部应用程序被打开。

I need to work with some temporary files in my Windows Forms .NET 3.5 application. Those files are opened in an external application that can of course be running for a longer time than my own program.

是否有任何的最佳做法,以确保这些临时文件清理在任何时间,以避免占用用户的硬盘与不再需要的垃圾文件?抑或甚至是Windows种自动处理这个?

Are there any best practices to make sure these temporary files are cleaned up at any time in order to avoid filling the user's hard disk with "junk" files which aren't needed anymore? Or does even Windows kind of handle this automatically?

一个很好的例子是任何邮件客户端:当你在任何应用程序打开附件,它通常是写入其打开一个临时文件。有没有办法找出这些文件是如何管理的清理?

A nice example is any mail client: When you open an attachment in any application, it is usually written to a temporary file which is opened. Is there a way to figure out how those files manage cleanup?

使用谷歌已经表明了我很多很多的清理和调整行动的工具来清洁手临时目录,但我不喜欢强迫用户这样做。 : - )

Using Google has shown me many, many cleanup and tune-up tools to clean the temp directory by hand, but I'd not like to force the users to do so. :-)

任何帮助是AP preciated。

Any help is appreciated.

马蒂亚斯

推荐答案

如果您尝试确定性清除临时文件类型的文件夹中的内容,你可能删除正在使用由其他进程文件。 Windows操作系统提供了一些工具,允许用户删除这些文件时,该卷的可用磁盘空间达到一定的阈值。

If you attempt to deterministically clear the contents of a Temporary Files type folder, you risk removing files that are in use by other processes. The Windows operating system provides tools to allow users to remove those files when the volume's available disk space reaches a certain threshold.

现在,如果你能确定你使用特定的临时文件,它将不再需要后,那么就没有下侧,以删除特定文件。

Now, if you can determine that after you use a specific temporary file that it will no longer be needed, then there's no down-side to deleting that specific file.

这篇关于删除后,使用临时文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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