c# - 目录大小改变事件

标签 c# file c#-4.0 filesystems directory

有什么方法可以在 C# 中监控目录大小。我使用一个目录来缓存文件,但我想限制它正在使用的磁盘空间。(即删除文件以减少空间使用) 提前致谢。

最佳答案

看看FileSystemWatcher Events

专门看FileSystemWatcher.Changed Event

根据MSDN

The Changed event is raised when changes are made to the size, system attributes, last write time, last access time, or security permissions of a file or directory in the directory being monitored.

关于c# - 目录大小改变事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9565474/

相关文章:

c# - 在 DAL 中使用单例模式的优缺点

java - Byte[] 和 java.lang.OutOfMemoryError 逐位读取文件

c# - 计算类文件中 appconfig 中的键数

c# - 在调用 c++ 代码时出现访问冲突错误是 c#

C#/.NET Timers 和 Win32 Sleep 函数都不准确

c# - 如何让 ffmpeg 在 try/catch 上为工作目录和参数抛出异常?

iphone - 如何以安全的方式在后台线程中执行文件导入?如何在后台进行安全的文件 I/O 事务?

wpf - 如何更改 TreeView 的视觉效果以自动显示 SelectedItem?

c# - 为 Controller Action 参数创建过滤属性抗XSS攻击

javascript - 在 JavaScript 中访问本地文件修改时间