The script is a "debug" version, to try and get a handle on how and why you are getting the exception.
You need to ensure it runs through to completion before you start to worry about adding other features.
Something like this will do you however:
Code:
Break ON
$=SetOption("WrapAtEOL","ON")
Global $iRecursiveDepth
Global $oShell
$oShell=createobject("shell.application")
drivescan("\\SGB007968\c$")
"Done." ?
Function drivescan($sPath)
Dim $oItem
For Each $oItem in $oShell.namespace($sPath).items
If $oItem.isfolder
$iRecursiveDepth=$iRecursiveDepth+1
"New recusion <"+$iRecursiveDepth+"> "+$oItem.path ?
drivescan($oItem.path)
$iRecursiveDepth=$iRecursiveDepth-1
Else
If 2799<$oItem.size AND 2901>$oItem.size
"*** File match "+$oItem.size+" "+$oItem.path ?
EndIf
EndIf
Next
Exit 0
EndFunction