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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File reporting utility

Status
Not open for further replies.

HupAhh

MIS
Oct 24, 2003
60
IE
Hi,

I'm looking for a utility (preferably free) which I can run on my Windows 2000 file server to give me a list of the files taking up the most space, the users taking up the most space etc. etc. In the past I've been using search to find this information but with almost 1Tb of data this just isn't sustainable!!

Anyone ever come across a tool like this?

Thanks,
P
 
VBScript can easily do this for you. You can easily enumerate all of the folders, check file sizes and if they match your criteria write the results to a text file of perform a database insertion.

I hope you find this post helpful.

Regards,

Mark
 
I've attempted writing a script a couple of times but couldn't get it to do what I wanted...
 
Something to get you started.


Code:
'==========================================================================
'
' NAME: <filename>
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 12/23/2003
'
' COMMENT: <comment>
'
'==========================================================================

'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

'FolderPath = Wscript.Arguments(0)
'MinSize = Wscript.Arguments(1)
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.

Regards,

Mark
 
I get an error on line 19 of the code "subscript out of range". The objArgs variable was not declared so I changed that but I'm still getting the error..

P
 
Don't change it. Runt he script from a command line with CSCRIPT and feed it the path to the directory you want to start the scan at.

I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top