?
Solved

Sleep A While Then Check For File

Posted on 2005-03-15
2
Medium Priority
?
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

777 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