I am running a script that looks at certain folder locations on specified PCs and tells me the folder size. It works fine for Win 7 PCs but is failing when it looks at XP machines.
I have a attached the code here. It seems to run fine until it gets to the line that says:
Do While Not objExec.StdOut.AtEndOfStre
And at that point it does not move into that area, it just moves to the next item in the Folderlist.xls file.
I can't see anything wrong with it and I thought it worked before. I know it works on Win 7 PC's but not on Win XP.
thanks for any help you can provide.
'On Error Resume Next
inputfile="C:\folderlist.xls" 'path of excel file
outputfile="C:\output.txt" 'path of output file to be written
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(inputfile)
Set objFSO = CreateObject("Scripting.FileSystemObject")
intRow = 1
Do Until objExcel.Cells(intRow,1).Value = ""
Set objShell = CreateObject("Wscript.Shell")
command = "du.exe " & folder_path
Set objExec = objShell.Exec(Command)
Do While Not objExec.StdOut.AtEndOfStream
strText = Trim(objExec.StdOut.ReadLine())
' Test or display strText
If InStr(strText,"Size: ")>0 Then
WScript.Echo "File size " & fsizedbl
'outputfile.WriteLine strcomputer & "," & folder & "," & fsize
outputfile.WriteLine strcomputer & "," & folder & "," & Replace(fsize, ",", "") '
intRow = intRow + 1