Hi,
You could simply write a VBScript to accomplish this. See below, this is pretty variable and allows you to accomplish this.
'Execute:
'Argument 0 = amount of files
'Argument 1 to x = file-path in ""
'CheckMultipleFileSizes.vbs 2 "C:\path\file" "\\server\share\path\file"
Dim iFiles
Dim strPaths
Dim cnt
If WScript.Arguments.Count > 1 Then
iFiles = WScript.Arguments.Item(0)
For cnt = 1 To iFiles
If Len(strPaths) > 0 Then
strPaths = strPaths & "|&|"
End If
strPaths = strPaths & WScript.Arguments.Item(cnt)
Next
Else
Wscript.Echo "Usage: cscript CheckMultipleFileSizes.vbs 2 ""C:\path\file"" ""\\server\share\path\file"""
Wscript.Quit
End If
Dim fs
Dim objFile
Dim strPathTemp
WScript.echo "<prtg>"
Set fs = CreateObject("Scripting.FileSystemObject")
strPathTemp = Split(strPaths,"|&|")
For cnt = 0 To UBound(strPathTemp)
If fs.FileExists(strPathTemp(cnt)) Then
Set objFile = fs.GetFile(strPathTemp(cnt))
WScript.echo "<result>"
WScript.echo "<channel>" & objFile.Name & "</channel><value>" & objFile.Size & "</value>"
WScript.echo "</result>"
End If
Next
Set fs = Nothing
WScript.echo "</prtg>"
Will post this as well on my personal blog since it seems to be a valuable and pretty variable sensor.
Regards
Florian Rossmark
www.it-admins.com
EDIT:
changed line 13 form If Len(strPath) > 0 Then to If Len(strPaths) > 0 Then
Add comment