![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Flag or reserve a file I have a file watcher that I have written and I need to find a way to flag or reserve a file as being "watched" so that the same filewatcher doesn't try to process it again. I would appreciate any ideas of how to do this. I have tried renaming the file but if the file is in use via an FTP, I have to go into a sleep mode until the file is completely transferred and if the polling interval overlaps, the filewatcher tries to process the same file again. Best Regards, Gil. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Flag or reserve a file "Gil" <gilbertcardenas@xxxxxx> wrote in message news:b9e7a01a-db9a-4b56-87d4-b6047fcde7a1@xxxxxx Quote: >I have a file watcher that I have written and I need to find a way to > flag or reserve a file as being "watched" so that the same filewatcher > doesn't try to process it again. I would appreciate any ideas of how > to do this. > I have tried renaming the file but if the file is in use via an FTP, I > have to go into a sleep mode until the file is completely transferred > and if the polling interval overlaps, the filewatcher tries to process > the same file again. > > Best Regards, > Gil. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Flag or reserve a file Gil wrote: Quote: > I have a file watcher that I have written and I need to find a way to > flag or reserve a file as being "watched" so that the same filewatcher > doesn't try to process it again. I would appreciate any ideas of how > to do this. > I have tried renaming the file but if the file is in use via an FTP, I > have to go into a sleep mode until the file is completely transferred > and if the polling interval overlaps, the filewatcher tries to process > the same file again. the mean time, you could try my IsFileInUse function in your script in a loop. If file is not in use, simply Exit the loop. You may want to include a breif Sleep delay to allow the ftp process more cpu cycles. Dim filespec filespec = "watchedfile.txt" 'File to check If IsFileInUse(filespec) Then MsgBox filespec & " is in use." Else MsgBox filespec & " is NOT in use." End If Wscript.Quit Function IsFileInUse(filespec) Dim fso, f, tmp Set fso = CreateObject("Scripting.FileSystemObject") IsFileInUse = False If (fso.FileExists(filespec)) Then On Error Resume Next Set f = fso.OpenTextFile(filespec, 8): f.Close If Err.Number Then IsFileInUse = True On Error GoTo 0 End If End Function -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| QoS Bandwidth Reserve Limit | Tutorials | |||
| Country Flag | General Discussion | |||
| WLM miss reply flag | Live Mail | |||
| Sort by Flag broken | Vista mail | |||
| Windows Mail and the Little Flag | Vista mail | |||