p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VBScript (http://p2p.wrox.com/forumdisplay.php?f=77)
-   -   Microsoft VBScript error runtime error: File not found (http://p2p.wrox.com/showthread.php?t=99921)

RICARDO1615 June 29th, 2018 09:57 PM

Microsoft VBScript error runtime error: File not found
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
End if


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
ExitCode = 5
End If

'Desconstrução dos objetos que foram ulizados no ambiente
Set objfso = Nothing
Set Pasta = Nothing
Set objArquivosExistentes = Nothing
Set objTextFile = Nothing
WScript.Quit ExitCode

All times are GMT -4. The time now is 08:41 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.