createscript
Technical User
Dear all,
Here is need you help, the script use to check for each folder size and output to csv format.
The script run to check all the folder size
e:\packages$\install\KBXXX\XXXX\XXX. It is because the Microsoft KB has other sub-directory. I have no idea how to write the code which can run the size of sub-directory for each and output the size and folder name.
Below is the code
Const ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set fs = fs
penTextFile("c:\temp\DirSize.csv", ForAppending, True)
Do
WScript.StdOut.Write "Please enter directory name: "
strFolder = WScript.StdIn.ReadLine
If fso.FolderExists(strFolder) Then
Exit Do
Else
WScript.StdOut.Write "Invalid Directory ... Try Again" & vbCrLf
End If
Loop
Set f = fso.GetFolder(strFolder)
WScript.Echo f.Path & ": " & FormatNumber((f.Size / 1048576),4,,TriStateTrue) & " Bytes"
fs.WriteLine f.Path & "," & Replace(FormatNumber((f.Size / 1048576),4), ",", "")
fs.Close
Anyone expert can help me to solve the probelm
Thank you very much
Here is need you help, the script use to check for each folder size and output to csv format.
The script run to check all the folder size
e:\packages$\install\KBXXX\XXXX\XXX. It is because the Microsoft KB has other sub-directory. I have no idea how to write the code which can run the size of sub-directory for each and output the size and folder name.
Below is the code
Const ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set fs = fs
Do
WScript.StdOut.Write "Please enter directory name: "
strFolder = WScript.StdIn.ReadLine
If fso.FolderExists(strFolder) Then
Exit Do
Else
WScript.StdOut.Write "Invalid Directory ... Try Again" & vbCrLf
End If
Loop
Set f = fso.GetFolder(strFolder)
WScript.Echo f.Path & ": " & FormatNumber((f.Size / 1048576),4,,TriStateTrue) & " Bytes"
fs.WriteLine f.Path & "," & Replace(FormatNumber((f.Size / 1048576),4), ",", "")
fs.Close
Anyone expert can help me to solve the probelm
Thank you very much