Question : Retrieve size of the disk and folder with vbscript

I have an excel spreadsheet that has data in one column
server1name\drivename
server2name\drivename\foldername
server2name\drivename\foldername
..
...

I would like to have a script that goes from the top row to bottom row of excel spreadsheet and calculate the size of the disk Or folder and write it in a text file.

Thanks

Answer : Retrieve size of the disk and folder with vbscript

The Script For Retrieve size of the disk and folder.
Const ForWriting = 2
Const cIntOneGig = 1073741824 ' 1024 * 1024 * 1024

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objDocsFolder = objFSO.GetFolder("C:\Documents and Settings")
Set objOutputFile = objFSO.OpenTextFile("C:\Logfile.csv", ForWriting, True)

objOutputFile.WriteLine "UserName,Folder Name,Folder Size"

For Each objUserFolder In objDocsFolder.Subfolders
  ProcessUserFolder objUserFolder
Next

objOutputFile.Close
Set objOutputFile = Nothing
Set objDocsFolder = Nothing
Set objFSO = Nothing

Sub ProcessUserFolder(ByRef objFolder)
  For Each objSubfolder In objFolder.Subfolders
    If (objSubfolder.Size > cIntOneGig) Then
      objOutputFile.WriteLine objFolder.Name & "," & objSubfolder.Name & ",""" & FormatNumber(CDbl(objFolder.Size) / 1024 / 1024 / 1024, 2) & " GB"""
    End If
  Next
End Sub

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21482488.html?query=VBScript+to+retrieve+folders+size&clearTAFilter=true

Random Solutions  
 
programming4us programming4us