[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

File Exists and Loop

Posted on 2008-10-07
3
Medium Priority
?
833 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
[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
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

656 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