Folder Report VbScript


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'************************************************************
' File:  FolderReport.vbs
'
'************************************************************

strSource="c:\"
iGrandTotalCount=0
iGrandTotalSum=0

Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFolder=objFSO.GetFolder(strSource)

Call ProcessFiles(objFolder)

WScript.Echo "Total count = " & iGrandTotalCount &_
" files (" & iGrandTotalSum & " bytes)"

Sub ProcessFiles(objFolder)
Set colFiles=objFolder.Files
iSum=0

For Each file In colFiles
iSum=iSum+file.size
Next

'increment grand total counters
iGrandTotalSum=iGrandTotalSum+iSum
iGrandTotalCount=iGrandTotalCount+colFiles.Count

wscript.Echo objFolder & " = " & colFiles.Count &_
" files (" & iSum & " bytes)"

'process Subfolders
Call ProcessSubFolders(objFolder)

End Sub

Sub ProcessSubFolders(objFolder)
Set colSubs=objFolder.SubFolders
For Each folder In colSubs
ProcessFiles(folder)
Next

End Sub



You can leave a response, or trackback from your own site.


Further Reading
    None Found




Leave a Reply

Anti-Spam Quiz:

Twitter Delicious Facebook Digg Stumbleupon Favorites More
334 queries in 3.340 seconds.