Microsoft VBScript error runtime error: File not found
Gentlemen
I'm running a vbs to which it performs folder checking and checks if files have been left standing for more than an hour in some folders. The process is displaying the following error:
D: \ Control-M \ monitora_pedido.vbs (47, 3) Microsoft VBScript runtime error: File not found
The following is vbscript:
Dim SizeFile, NameFile, DateFile, SearchFile, dtmThisDay, dtmThisMonth, dtmThisYear, dtmThisHour, _
dtmThisMinute, dtmThisSecond, DateLastFile, strts, cont, flag, FileDirLog, ExitCode, vetorpasta(1)
'Inicializa as variaveis do timestamp
dtmThisDay = Day(Date)
dtmThisMonth = Month(Date)
dtmThisYear = Year(Date)
dtmThisHour = Hour(Time)
dtmThisMinute = Minute(Time)
dtmThisSecond = Second(Time)
ExitCode = 0
'Cria objetos
Set objShell = CreateObject("Shell.Application")
Set objfso = CreateObject("Scripting.FileSystemObject")
'Cria objetos Pedidos
vetorpasta(1) = "\\SERVER1\root$\FILES\PROCESSED\REQUEST"
'Cria arquivo de logs
FileDirLog = "D:\Control-M\LOG\Log_PEDIDOSOUT"&dtmThisDay&dtmThisMonth&dtmT hisYear&dtmThisHour&dtmThisMinute&dtmThisSecond&". txt"
Set arqWrite = objFSO.OpenTextFile(FileDirLog, 8, True)
For i = 1 to 1
Set ObjPasta = objfso.GetFolder(vetorpasta(i))
Set objArquivosExistentes = objPasta.Files
for each arquivo in objArquivosExistentes
NameFile = arquivo.Name
DateFile = arquivo.DateCreated
dblDifHoras = DateDiff("s", DateFile, now)
CalculaHora = dblDifHoras \ 60
if CalculaHora > 30 then
strts = "Arquivo "&NameFile&" na pasta "&vetorpasta(i)&" desde as "&DateFile
arqWrite.WriteLine(strts)
End if
next
Next
arqWrite.Close()
Set Filelog = objFso.GetFile(FileDirLog)
Set Filelog1 = objFSO.OpenTextFile(FileDirLog)
SizeFile = Filelog.Size '\1024
'msgbox SizeFile
If SizeFile > 0 Then
While Filelog1.AtEndOfStream <> True
x = Filelog1.ReadLine
wScript.echo(x)
Wend
ExitCode = 5
End If
Filelog1.Close()
Filelog.Delete(force)
'Desconstrução dos objetos que foram ulizados no ambiente
Set objfso = Nothing
Set Pasta = Nothing
Set objArquivosExistentes = Nothing
Set objTextFile = Nothing
WScript.Quit ExitCode
|