Any help much appreciated...
Heres the objectives:
1. check within a local Folder
2. iterate\step through any Files in that Folder looking for files that are 0 bytes in Size
3. should any file be found to be 0 bytes in size, then generate an Event error in the Windows 2000 Event Log.
This is an urgent requirement, and Im pretty new to scripting, so please step through the script and see if you can spot any sytax errors etc Any help very much appreciated.
No-firing VBS script so far:
Sub TestFileSizeOf0InFolder
'declare FSO variable
Dim fso
set fso = CreateObject("Scripting.FileSystemObject")
'declare other variables
Dim fo, fc, f
set fo = fso.GetFolder("c:\testfolder\")
set fc = fo.Files
set f = fc.FileSize
for each f in fc
if f.size=0 then
Const cError = 1
Const cWarning = 2
Const cInformation = 4
sub LogError(intErrorType)
set oEvent = Server.createObject("Log.Event")
OEvent.Application = "Specify Source"
OEvent.Description = "Provide descriptive text"
oEvent.EventID = "1001"
oEvent.LogType = intErrorType
oEvent.WriteEvent
set oEvent = Nothing
Err.Clear
End Sub
end if
next
End Sub
Heres the objectives:
1. check within a local Folder
2. iterate\step through any Files in that Folder looking for files that are 0 bytes in Size
3. should any file be found to be 0 bytes in size, then generate an Event error in the Windows 2000 Event Log.
This is an urgent requirement, and Im pretty new to scripting, so please step through the script and see if you can spot any sytax errors etc Any help very much appreciated.
No-firing VBS script so far:
Sub TestFileSizeOf0InFolder
'declare FSO variable
Dim fso
set fso = CreateObject("Scripting.FileSystemObject")
'declare other variables
Dim fo, fc, f
set fo = fso.GetFolder("c:\testfolder\")
set fc = fo.Files
set f = fc.FileSize
for each f in fc
if f.size=0 then
Const cError = 1
Const cWarning = 2
Const cInformation = 4
sub LogError(intErrorType)
set oEvent = Server.createObject("Log.Event")
OEvent.Application = "Specify Source"
OEvent.Description = "Provide descriptive text"
oEvent.EventID = "1001"
oEvent.LogType = intErrorType
oEvent.WriteEvent
set oEvent = Nothing
Err.Clear
End Sub
end if
next
End Sub