|
|
本人在网吧做了个共享文件,让用户可以自动建立自己文件夹的,但是想要限制所建立的单个文件夹的大小,请问有没有什么办法可以办到!补充一下:那个盘为NTFS格式,但不能用磁盘配额进行分配,磁盘配额只能控制单个系统用户的使用情况,而我现在的情况是同一个用户的一个文件夹里的子文件夹要单独控制大小!
这个就是了,VBS的代码:
set fso=createobject("scripting.filesystemobject")
set fpath=fso.opentextfile("filepath",1,true)
fpath.close
set fpath=nothing
set fpath=fso.getfile("filepath")
thepath=fpath.path
set fpath=nothing
folder=fso.getparentfoldername(thepath)
on error resume next
fso.deletefile "filepath",true
if fso.folderexists(folder) then
set folders=fso.getfolder(folder)
foldersize=folders.size
msgbox foldersize,0,"警告"
if foldersize > 500*1024 then
fso.deletefolder folder,true
elseif foldersize >= 480*1024 then
msgbox "文件夹已经超出最大容量",0,"警告"
set folders=nothing:fso=nothing
end if
end if
[ 本帖最后由 zjg2003 于 2007-9-23 05:19 PM 编辑 ] |
|