是否可以在 Windows 环境中限制文件夹大小?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/532775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to limit folder size in a Windows environment?
提问by Alceu Costa
Is it possible to limit a folder size in Windows so that when a user tries to write to the folder when it is full he receives an error message?
是否可以限制 Windows 中的文件夹大小,以便当用户尝试写入已满的文件夹时,他会收到错误消息?
回答by benPearce
Keep in mind that Disk Quotas are per user not per folder, there are other solutions that will allow you to lock down a folder size regardless of user, my experience has been with Veritas Storage Exec, but it seems to be discontinued.
请记住,磁盘配额是每个用户而不是每个文件夹,还有其他解决方案可以让您锁定文件夹大小而不管用户如何,我的经验是使用 Veritas Storage Exec,但它似乎已停止使用。
回答by Rob
Do you mean disk quotasas described at, e.g. http://www.windowsnetworking.com/articles_tutorials/Configuring-Disk-Quotas-Windows-2003.html?
您是指如http://www.windowsnetworking.com/articles_tutorials/Configuring-Disk-Quotas-Windows-2003.html 中所述的磁盘配额吗?
回答by Robert Calhoun
The Windows Server 2008 Administrator's Companionrecommends using the File Server Resource Managerinstead of the older "disk quota" feature since these allow per-directory settings. (I'm not familiar with this tool myself; after 5 mins of playing around with it, I still have no idea how to actually do this. There certainly is a column for "quota", however.)
在Windows Server 2008的管理员的同伴建议使用文件服务器资源管理器,而不是旧的“磁盘配额”功能,因为这些让每个目录设置。(我自己对这个工具并不熟悉;在玩了 5 分钟之后,我仍然不知道如何真正做到这一点。但是,当然有一个“配额”专栏。)
Another trick is to create a new volume and then use a symbolic link (see MKLINK) to map the directory to that volume. (MKLINK is Vista/2008 and later; for XP/2003 use NTFS junctions.)
另一个技巧是创建一个新卷,然后使用符号链接(请参阅MKLINK)将目录映射到该卷。(MKLINK 是 Vista/2008 及更高版本;对于 XP/2003,请使用NTFS 连接。)
回答by Assaf Lavie
It depends on how limiting you want to be. :)
这取决于您想要限制的程度。:)
For example, it's not difficult to write a program that listens/monitors a folder and displays a message box error/warning in case the user exceeds his quota. But that doesn't preventhim from exceeding it - just notifies him he did so.
例如,编写一个程序来侦听/监视文件夹并在用户超出配额时显示消息框错误/警告并不困难。但这并不能阻止他超越它——只是通知他他这样做了。