How to check if file exists, if not then wait 30 seconds and try again, if it does continue on to next action

Looking to check if a file exists (flag file)
if it does not exist then wait 30 seconds
and loop to top to check if file exists again
if it does exist continue on to next action

How is it best to achieve this outcome?

To solve this issue I would use the “If file/folder exists”, “if” and “delay” actions.

The file exists action would save the result of the file existence to a variable that would be tested in the if action. The child of the if action would be a delay action for 30 seconds. The next child action would then simply be a copy of the first if file exists.

After these set of actions are called, the variable would contain whether or not the file exists. If required it would have waited for it to exist.

If you wish to stop processing if the file does not exist simply use another if action testing the existence variable. Then follow this with a stop build action.