' PLEASE NOTE THAT YOU WOULD NEED EXCEL INSTALLED ON YOUR MACHINE
Dim oFS, oFolder
Dim objexcel, r, lnameArray, lname, nameLength
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
set oFolder = oFS.GetFolder("D:\GE")
Dim objexcel, r, lnameArray, lname, nameLength
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
set oFolder = oFS.GetFolder("D:\GE")
Set objExcel = createobject("Excel.application")
objexcel.Workbooks.add
objexcel.Cells(1, 1).Value = "Folder Path"
objexcel.Cells(1, 2).Value = "Folder Name"
objexcel.Cells(1, 3).Value = "Size (MB)"
objexcel.Cells(1, 4).Value = "# Files"
objexcel.Cells(1, 5).Value = "# Sub Folders"
objexcel.Visible = True
Wscript.Sleep 300
r=2
objexcel.Workbooks.add
objexcel.Cells(1, 1).Value = "Folder Path"
objexcel.Cells(1, 2).Value = "Folder Name"
objexcel.Cells(1, 3).Value = "Size (MB)"
objexcel.Cells(1, 4).Value = "# Files"
objexcel.Cells(1, 5).Value = "# Sub Folders"
objexcel.Visible = True
Wscript.Sleep 300
r=2
ShowFolderDetails oFolder, r
' objexcel.ActiveWorkbook.SaveAs("LogonReport.xls")
' objexcel.Quit
MsgBox "Done"
Function ShowFolderDetails(oF,r)
Dim F
objexcel.Cells(r, 1).Value = oF.Path
objexcel.Cells(r, 2).Value = oF.Name
objexcel.Cells(r, 3).Value = oF.Size /1024\1024
objexcel.Cells(r, 4).Value = oF.Files.Count
objexcel.Cells(r, 5).Value = oF.Subfolders.count
r = r+1
for each F in oF.subfolders
ShowFolderDetails F, r
next
End Function
No comments:
Post a Comment