![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Do while fso.FileExists() question Have a log file from a ftp session started with vbs script. This script: 1. Downloads the ftp log to my local hard drive as "c:\ftp.log" 2. Opens "ftp.log" for reading. 3. Read one line at a time. 4. If string "Yada-Yada" is found in "ftp.log" (usually in the 1st or 2nd line) data set on MVS mainframe is ready to be downloaded, 5 Open another ftp session and download mainframe data set 6. fso.DeleteFile("c:\ftp.log") and exit sub However, if the string "Yada-Yada" is NOT found in "ftp.log" then Wscript.sleep xxxxxx start another ftp session starting back at step #1. Keep running this ftp script every "X" (wscript.sleep) number of minutes until the MVS mainframe job is complete as evidenced in the refreshed "c:\ftp.log" on my hard drive. MVS job could take hours. I tried Do While fso.FileExists("c:\ftp.log") with ftp.log being deleted via fso.DeleteFile("ftp.log") upon successful reading of the "Yada-Yada" string (so that should stop the process as "C:\ftp.log" no longer exists????) but it seems cumbersome, not to mention it doesn't work. How would I loop back through a process, terminating only if a certain string is found in a file that is re-downloaded every "X" number of minutes? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Do while fso.FileExists() question JumboShrimps wrote: Quote: > Have a log file from a ftp session started with vbs script. > > This script: > 1. Downloads the ftp log to my local hard drive as "c:\ftp.log" > 2. Opens "ftp.log" for reading. > 3. Read one line at a time. > 4. If string "Yada-Yada" is found in "ftp.log" > (usually in the 1st or 2nd line) > data set on MVS mainframe is ready to be downloaded, > 5 Open another ftp session and download mainframe data set > 6. fso.DeleteFile("c:\ftp.log") and exit sub > > However, if the string "Yada-Yada" is NOT found in "ftp.log" then > Wscript.sleep xxxxxx > start another ftp session starting back at step #1. > > Keep running this ftp script every "X" (wscript.sleep) number of > minutes > until the MVS mainframe job is complete as evidenced in the > refreshed "c:\ftp.log" on my hard drive. > MVS job could take hours. > > I tried Do While fso.FileExists("c:\ftp.log") > with ftp.log being deleted > via fso.DeleteFile("ftp.log") upon successful > reading of the "Yada-Yada" string > (so that should stop the process as "C:\ftp.log" no longer > exists????) > but it seems cumbersome, not to mention it doesn't work. > > How would I loop back through a process, terminating only if a certain > string is found in a file that is re-downloaded every "X" number of > minutes? and what should happen and where. Do If fso.FileExists("c:\ftp.log") Then 'Read file for "Yada-Yada" If found Then '.DeleteFile... 'download dataset Exit Do End If Else 'File does not exist. 'Either keep looping or Exit Do End If Sleep xxx... Loop -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| escape character question - hopefully an easy question | PowerShell | |||
| Workaround for using wildcard "*" with FileExists method | VB Script | |||
| vista genral question and ultimate question | Vista General | |||
| Dual boot system question and family deal discount question | Vista General | |||
| OEM question | Vista installation & setup | |||