Validate file path returned by bot

Hello! I am new to UiPath…

I am currently working on a program that runs a UiPath bot to retrieve a file path and I would like to validate it if its correct. As sometimes it returns ‘C:\Users\Downloads\report.csv’ but sometimes it returns ‘C;\Users\Downloads\report.csv’. Hence, I was thinking of including a do while loop but I am unsure of what to set as the condition as the ‘report.csv’ part does not have a fixed name, it changes every time. Additionally, the file path is saved in a variable.

Hey @x_xxx

Welcome to UiPath Community!

You can use the Path Exist activity which will return the True false i.e. Boolean value.

And You can replace the dynamic part to *

Thanks

Hello! Thank you for the swift response.

Do you mean like this >> “C:\Users\Downloads*”?

But how do I incorporate it in a dowhile loop?

Hi!

have a view on this thread

Regards,
NaNi

Hi @x_xxx

Try this expression

“C:\Users\Downloads"+Variable Of File Path+”.csv"

Regards
Gokul

Thank you so much!

Do you have an idea how to incorporate this into a do while loop?
For example, the loop will check if the syntax of the file path is correct, if so, it will execute the next step. However, if the file path’s syntax is wrong, then it will rerun the entire flow…

Hi @x_xxx

You can use File Exist Activity which will return the True false i.e. Boolean value

In Do While loop you can pass the Boolean value

image

I have a Doubt? Why are using Do While Loop

Regards
Gokul

(post deleted by author)

Hello @Gokul001

The bot that I am currently creating will automatically refresh itself every 15 minutes. Sometimes, the file path typed by the bot, i.e. C:\Users\Downloads, might be typed as C;\Users\Downloads, which I have no idea why too.

Hence, I thought a do while loop will be good to check on whether the syntax of the file path is correct, otherwise my bot will fail. Or is there another way of doing this?

I hope this is clearer!

Hi @x_xxx

  1. Before tying you can keep Delay 00:00:03

Can you share the screenshot of the XAML and elaborated the Task

Regards
Gokul

Hi,

Just thought from my side can we go like below.

Once we get file path in variable before accessing the file path simply replace ; with :

If you have the special character ; it will automatically replace or it will not do anything. I think you need to go for while loop for this. Please try and let us know. Thanks.

If you still face issue pls share with us screenshot so that we would help you in better way. Thanks.

YourFilePath.replace(“;”,“:”)