是否可以在 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:02:16  来源:igfitidea点击:

Is it possible to limit folder size in a Windows environment?

windowsdirectory

提问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 ZombieSheep

Have a look at Quotasfor NTFS file systems..

看看NTFS 文件系统的配额..

回答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.

例如,编写一个程序来侦听/监视文件夹并在用户超出配额时显示消息框错误/警告并不困难。但这并不能阻止他超越它——只是通知他他这样做了。