Folder Size
Hi,I am wanting to run a report either through a script or an existing application (hopefully free) which will tell me the following:* size of each folder* breakdown of each AD user size within the folderI have used some FSRM Reports but to do it on each directory would just take too long.Is there a script out there for which something like this exists? I don't care what sort of data or how many files etc. Just something simple.For example:Directory: d:\public\share\blahSize: 45GBUser Breakdowntest.user: 10GBtest2.user2: 20GBtest3.user2: 10GBunknown: 5GBSomething like that would be great.Thanks in advance,TerryTerry
http://www.sucked-in.com
August 5th, 2009 6:52am
Hi,
There are some free tools to report folder size. For example:
Folder Size for Windows 2.4http://foldersize.sourceforge.net/ Please Note: The third-party product discussed here is manufactured by a company that is independent of Microsoft. We make no warranty, implied or otherwise, regarding this product's performance or reliability.
However, to analyze the User Breakdown, you may customize a script to analyze every folder. There are some sample script to manipulate folder:
folder http://www.microsoft.com/technet/scriptcenter/scripts/ad/users/default.mspx?mfr=true
If you have any difficulties when you customizing the scripts, I suggest that you initial a new post in The Official Scripting Guys Forum! to get further support there. They are the best resource for scripting related problems.
For your convenience, I have list the link as followed.
The Official Scripting Guys Forum!http://social.microsoft.com/Forums/en-US/ITCG/thread/34ed6cba-7698-4aa8-b13c-8693081296ef
Thanks.This posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
August 5th, 2009 2:11pm
I wrote something like this in VB. It's not perfect but I hope that these script will be useful.It works recursively so don't give too many objects to scan.You get somthing like This:For each file:File size: xxxFile name: xxxOwner: xxxAnd at end:User1: total sizeuser2....Total Folder size: xxx
Function parseSize(size)
If size < 1024 Then
parseSize = size & " bytes"
Exit Function
Else
If size < 1048576 Then
parseSize = Round(size/1024,2) & " KB"
Exit Function
Else
If size < 1073741824 Then
parseSize = Round(size/1048576,2) & " MB"
Exit Function
Else
If size < 1099511627776 Then
parseSize = Round(size/1073741824,2) & " GB"
Exit Function
End If
End If
End If
End If
End Function
Function in_array(element, arr)
For i=1 To Ubound(arr)
If Trim(arr(i)) = Trim(element) Then
in_array = i
Exit Function
Else
in_array = i*(-1)
IF Trim(arr(i)) = "" Then
Exit Function
End If
End If
Next
End Function
Function FolderScan(strFolderName)
Set objShell = CreateObject ("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objShell.Namespace (strFolderName)
Dim tmpFolderName
Dim inArrayStatus
For Each strFileName in objFolder.Items
If objFolder.GetDetailsOf (strFileName, 11) <> "Folder" then
set objFile = objFSO.GetFile(strFolderName & strFileName)
wscript.echo "File Size: " & parseSize(int(objFile.Size))
wscript.echo "File Name: " & strFolderName & objFile.Name
Wscript.echo "File owner: " & objFolder.GetDetailsOf (strFileName, 10)
inArrayStatus = in_array(objFolder.GetDetailsOf (strFileName, 10), users)
If inArrayStatus >= 0 Then
userSize(inArrayStatus) = userSize(inArrayStatus) + int(objFile.Size)
Else
users(inArrayStatus * (-1)) = objFolder.GetDetailsOf (strFileName, 10)
userSize(inArrayStatus * (-1)) = int(objFile.Size)
End If
Wscript.Echo
Else
tmpFolderName = objFolder.GetDetailsOf (strFileName, 0)
FolderScan(strFolderName & tmpFolderName & "\")
End If
Next
End Function
Dim users(10)
Dim userSize(10)
Dim catSize
FolderScan("c:\test\")
wscript.echo "_________________________________________"
For i = 1 To UBound(users)
IF Trim(users(i)) <> "" Then
wscript.echo users(i) & ": " & parseSize(userSize(i))
catSize = catSize + int(userSize(i))
End If
Next
wscript.echo
wscript.echo "Total folder size: " & parseSize(catSize)<br/><br/><br/><br/><br/><br/>
August 5th, 2009 6:48pm


