Why doesn't "Path Exists" have a timeout?

Let’s say I’m downloading a large file from the web, or I triggered some kind of local batch process that churns through a DB and emits an output file. Clearly I don’t know how long it’s going to take to fully arrive on my local disk before I can move along in my workflow.

If I use “Path Exists” right after I begin the download, it will fail. This forces me to either add a fixed “Delay” activity (always a bad idea)… or set up a loop where I retry “Path Exists”. Of course this forces me to also create and increment a counter to limit my retry attempts, etc.

Why doesn’t “Path Exists” simply have a timeout value (essentially a hidden retry under the covers)?

This would be huge.

2 Likes

Did you explore File Change Trigger Activity?

Unless I’m misreading it… that appears to apply to a file that already exists. I can’t hand it a path to a file that doesn’t exist yet.

Actually I see we can pass it a directory too. But which attribute of the directory do I monitor? Size?

I think it will, try specifying NotifyFilters to create.

Interesting.

However… that doesn’t have a timeout either.

How long will it wait before it gives up and allows me to retry if the file is never created?

1 Like

It actually goes into Monitor Events activity, please check the properties if that activity.

1 Like

Not documented very well. It’s not intuitive to me how I could retry a download 3X if it didn’t appear within a specific time period, for instance.

2 Likes

Hi @octechnologist,

I am facing the exact same problem. Did you manage to find a solution?

@FlpVsg
Just off the top of my head, you could simply use a Retry Scope with File Exists as the condition activity. You can set the time delay to like 00:00:01 then retry like 60 times for 1minute, and it will exit once the File Exists.

4 Likes

Thanks for the response @ClaytonM.

I pulled off a similar solution, using a count variable inside while and setting condition as “count < 20” meaning I’ll try 20 times to find the file in the directory. However, if it finds the file before it breaks the loop and continue the flow.

@FlpVsg Good idea. =)
Do While loop is something I used a while back but switched to Retry Scope cause I found it easier. Plus, the Retry scope will throw an error like if the file never shows up. In a Do While, you need additional logic so it doesn’t get stuck in an infinite loop and/or throws an error if file never shows up.

1 Like

Yeah I’m digging this Retry Scope approach. Thanks for that.

Maybe I’ll try “retry scope” then to make the code a bit clearer.
Thnks!

If i want to check path exists of one file that’s located on shared server,
because network speed’s slow, it will take time to access to the shared server
→ will timeout be reached in this case?

That depends on the value you specify for the timeout of the chosen activity you use. You are free to make a timeout as long or short as your requirements dictate.

Can you share the work flow.

Can’t use Path Exists as a condition in the Retry Scope Activity though.
Have to use While loop anyway.

Hi @snoopy
You should be able to use any activity that returns a Boolean output in the Condition part of the Retry. Alternatively, you can use that Boolean activity in the Action part, then use the Is True with the boolean variable in the Condition part (however, placing the Boolean activity in the Condition part is preferred).

Additionally, you can simply use the Is True activity (which is what I normally use anyway), and use a condition expression. For example, Directory.Exists(folder) or File.Exists(filepath) would work in the Is True.

EDIT: note: you can leave the action part blank if you just use a Boolean activity in the condition part.

Regards.

Hello Everyone,

We faced a similar issue with one of our projects. We created a custom activity that solves this.

You can have a look at it, if you’re trying to check if file exists till timeouts.