[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

File Exists and Loop

Posted on 2008-10-07
3
Medium Priority
?
838 Views
Last Modified: 2010-04-21
I need a batch file that will check to see if a file exists and run additional code. If the file does not exist then it will just loop until complete. Does anyone know how to accomplish?
0
Comment
Question by:earngreen
3 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 total points
ID: 22663222
Something like this (sleep.exe is in the Resource Kit; it's to prevent the machine from only waiting for the new file, depending on how fast you need to react to the arrival of the file, you can wait for longer)?

Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
@echo off
set WaitFile=C:\Temp\SomeFile.txt
:loop
sleep 1
if not exist "%WaitFile%" goto loop
REM Additional code below here ...

Open in new window

0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22663256
can also accomplish using
ping 127.0.0.1 -n 60 > nul

as opposed to sleep if you don't have the ability to download the reskit tools...the ping command is nearly the equivalent of a 60-second pause...
0
 

Author Closing Comment

by:earngreen
ID: 31503994
Thanks for the assistance
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

873 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