开发者

How to set the maximum size for a folder?

How could I limit the size for开发者_运维知识库 a folder on a USB drive? For example, if I set 5 MB for the size of a folder then I could not copy over 5 MB data to this folder.


There's no way to do this on a per-folder basis with the functionality built into the operating system. You can do it (as long as the device is formatted to NTFS) with drive quotas at the level of the whole drive/partition

Some further reading on drive quotas:

  • Reading quota information on an NTFS volume.
  • How can I query NTFS disk quotas in C#?

The only other way you could do this would be by writing some form of File System Filter driver, but this isn't something that's achievable at present in managed code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜