Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
c:\document and setting\administrator: 10,182,572,281 MBThe output is C:\Documents and Settings\Administrator 9710.8577
How can I start the New Thread here?
Could you tell me, is that mean send you the personal messages ?
I copy your code and run cscript //d check.vbs , check with csv format which is not match the console information
C:\Temp>cscript untitled.vbsMicrosoft (R) Windows Script Host Version 5.7Copyright (C) Microsoft Corporation. All rights reserved.Please enter directory name: d:\wfc\testlibD:\WFC\Testlib: 1.6922 MBC:\Temp>type dirsize.csvD:\WFC\Testlib,1.6922
WScript.Echo f.Path & ": " & FormatNumber((f.Size / 1048576),4,,TriStateTrue) & " MB"
fs.WriteLine f.Path & "," & Replace(FormatNumber((f.Size / 1048576),4), ",", "")
Set fs = fso.OpenTextFile("c:\temp\DirSize.csv", ForAppending, True)
Hi Sidewinder I run the same script on the another workstation, it is no problem on the size checking. I think it may be something wrong with my workstation. Last time I have the problem on the script to do the check the size, but I get message from my boss, he needs to check the case is run the script can show all the size of directory at once.I check the all KB / MSI folder size under the directory e:\Patches$\KBXXXX\xxxxx and output to csv with the size, but it is different folder in the KBxxxx folder directory. The script is complex and need to to in effort to do that? Thanks
Last time I have the problem on the script to do the check the size, but I get message from my boss, he needs to check the case is run the script can show all the size of directory at once.
Const ForAppending = 8Set fso = CreateObject("Scripting.FileSystemObject")Set fs = fso.OpenTextFile("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 & ": " & GetEditSize(f.Size)fs.WriteLine f.Path & "," & Replace(GetEditSize(f.Size), " ", ",")GetThePaths(f)fs.CloseSub GetThePaths(Folder) For Each Subfolder in Folder.SubFolders WScript.Echo SubFolder.Path & ": " & GetEditSize(SubFolder.Size) fs.WriteLine SubFolder.Path & "," & Replace(GetEditSize(SubFolder.Size), " ", ",") GetThePaths Subfolder NextEnd SubFunction GetEditSize(intSize) If intSize => (1024*1024*1024*1024) Then GetEditSize = Round(FormatNumber((intSize/(1024*1024*1024)), 4,, TriStateTrue), 2) & " TB" ElseIf intSize => (1024*1024*1024) Then GetEditSize = Round(FormatNumber((intSize/(1024*1024*1024)), 4,, TriStateTrue), 2) & " GB" ElseIf intSize => (1024*1024) Then GetEditSize = Round(FormatNumber((intSize/(1024*1024)), 4,, TriStateTrue), 2) & " MB" ElseIf intsize => 1024 Then GetEditSize = Round(FormatNumber((intSize/1024), 4,, TriStateTrue), 2) & " KB" Else GetEditSize = intSize & " Bytes" End If End Function
batch arithmetic only deals with integers.
Are you programme ? You are specialist for vb script.