Submitted By: Ajeeth

Modifies folder permissions based on the size of that folder. Permissions are revoked if the folder exceeds 10 megabytes in size and restored if the folder falls below the 10-megabyte level.

Visual Basic
Edit|Remove
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFolder = objFSO.GetFolder("D:\ProjectOperations")

Dim objF

 objF = Int(objFolder.size/1048576)
 Wscript.Echo objF & " MB"

 set oShell = Wscript.CreateObject("Wscript.Shell")
 sfolder = "I:\Project Operations"
 if objF > 10 then
  oShell.Run "%COMSPEC% /c echo y| cacls D:\ProjectOperations /p administrator:f Operations:r"
 end if 
 if objF < 10 then
  oShell.Run "%COMSPEC% /c echo y| cacls D:\ProjectOperations /p administrator:f Operations:c"
  end if

 set oShell = Nothing