Re: Report total file size
From: Ray at <%=sLocation%> [MVP] (%=sLocation%)
Date: 08/18/04
- Next message: Alex K. Angelopoulos [MVP]: "Re: Please confirm: No future for Scripting of IE?"
- Previous message: Brian Vallelunga: "Re: Check if a service is installed"
- In reply to: Jamie Jenkins: "Report total file size"
- Next in thread: Jamie Jenkins: "Re: Report total file size"
- Reply: Jamie Jenkins: "Re: Report total file size"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 17 Aug 2004 23:55:16 -0400
This will output the results into a CSV file, which may be a bit more
friendly, as when you loop through a subdir collection, they are not
necessarily looped through in an alphabetical order.
Const ROOT_DIR = "C:\Path"
Const RESULTS_FILE = "C:\results.csv"
Dim oFSO
Dim oRootDir, oSubdir
Dim sOutput, dblTotal
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oRootDir = oFSO.GetFolder(ROOT_DIR)
dblTotal = 0
For Each oSubDir In oRootDir.Subfolders
sOutput = sOutput & oSubdir.Name & "," & oSubdir.Size & vbCrLf
dblTotal = dblTotal + oSubdir.Size
Next
Set oRootDir = Nothing
sOutput = sOutput & "Total," & CStr(dblTotal)
oFSO.CreateTextFile(RESULTS_FILE).Write sOutput
Set oFSO = Nothing
Ray at home
"Jamie Jenkins" <jjenkins@american-appraisal.com> wrote in message
news:c611f9bf.0408171406.60877da8@posting.google.com...
> I'm very new to scripting, and need to create a VBS script that will
> "spider" through a server and report the total in each main folder.
> The folder structure looks like this:
>
> Main Share
> ----\ User1
> ---------\directory1
> ---------\directory2
> ---------\directory....
> ----\ User2
> ---------\directory1
> ---------\directory2
> ---------\directory....
> ----\ User3
> ---------\directory1
> ---------\directory2
> ---------\directory....
>
> I need an output file that would then look line this:
>
> Main Share
> User1 xxx,xxx,xxx
> User2 xxx,xxx,xxx
> User3 xxx,xxx,xxx
> =====================
> Total xxx,xxx,xxx
>
> Can anyone help me out?
>
>
> Thanks.
- Next message: Alex K. Angelopoulos [MVP]: "Re: Please confirm: No future for Scripting of IE?"
- Previous message: Brian Vallelunga: "Re: Check if a service is installed"
- In reply to: Jamie Jenkins: "Report total file size"
- Next in thread: Jamie Jenkins: "Re: Report total file size"
- Reply: Jamie Jenkins: "Re: Report total file size"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|