kbenderJavaCoder
kbenderJavaCoder

Reputation: 25

Waiting for a folder in a Batch script

I have a batch script that launches a tomcat server. The script starts the service, which unpacks the files and folders in the "webapps" directory. I want to copy image files (that are added by the customer) into the webapps directory so they can be used by the server. However i need to wait until the folder has been unpacked so that the directory exists before i can add the images to it, what command or commands could i used to make this happen (apart from just waiting an arbitrary long enough time)

Upvotes: 1

Views: 3871

Answers (1)

Danny
Danny

Reputation: 7518

I am no expert at this stuff but this works for me

@echo OFF
:START
if not exist c:\abc GOTO WAIT
GOTO COPY

:WAIT
:: pause for 1 second
ping 127.0.0.1 > nul
GOTO START

:COPY
ECHO "DO COPYING STUFF"

The ping is to put a 1 second pause between each check if the folder or file exists.

Upvotes: 4

Related Questions