Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

size of folders

Status
Not open for further replies.
Sep 18, 2003
43
US
Hey All,

We have a 7 terabyte server. what is the best way to see which folders are taking up the most space? is there some kind of utility or application that will either give you the size or size percentage relative to drive of folders and what they contain..NOT the files.
 
run this script from a command line with 2 arguments: starting folder and minimum folder size to report.

Code:
'Check all subfolders below given folder for size over a minimum size.
Dim FolderPath
Dim FolderSize
Dim MinSize

Set objArgs=WScript.Arguments
FolderPath=objArgs(0)
MinSize=CLng(objArgs(1)) 

Const CONVERSION_FACTOR = 1048576 'converts folder size to MB
'Const MinSize = 100 'set minimum folder size in MB.
If Wscript.Arguments.count = 0 Then
    Wscript.Echo "Usage: foldersize.vbs [folder][minimum size]"
    Wscript.Echo "Example: foldersize.vbs c:\myfolder 50"
    Wscript.Quit
End If


report = "Folder Size" & vbTab &"Folder Name" & vbCrLf
Set FSO = CreateObject ("Scripting.FileSystemObject")
ShowSubFolders FSO.GetFolder(FolderPath)
MsgBox Report
Sub ShowSubFolders (Folder)
    For Each SubFolder In Folder.SubFolders 
    FolderSize = SubFolder.Size / CONVERSION_FACTOR
        If FolderSize >  MinSize Then
            report = report & int(FolderSize) & vbTab & vbTab & SubFolder.Path & vbCrLf
        End If
        ShowSubFolders SubFolder
    Next

End Sub

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top