?
Solved

Sleep A While Then Check For File

Posted on 2005-03-15
2
Medium Priority
?
168 Views
Last Modified: 2012-05-05
How can i use WScript.Sleep in a loop that checks for a file in a directory every five minutes?  If the file is there, would like to delete it then do something else.  Will be running a schedule task that executes a VBS file.  Any help would be much appreciated.
0
Comment
Question by:madasczik
2 Comments
 
LVL 10

Expert Comment

by:Jini Jose
ID: 13552535
use a timer to do this
0
 
LVL 22

Accepted Solution

by:
JesterToo earned 2000 total points
ID: 13553693
Dim strFileName
strFileName = "YourFileName"
Set oFSO = CreateObject("Scripting.FileSystemObject")  

Do While true
   If oFSO.FIleExists(strFileName) Then
      ' do something here
      Exit Do
   End If
   Wscript.Sleep (5 * 60 * 1000) ' 5 minutes
Loop
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question