Get the string value of array

How to get the directory look like a mark on the screenshot? Assume the position index of which folder will be to get is not always will be same.

After that, i will be to access that directory.

Regards,
Brian Henokh

1 Like

@Brian_Henokh1 Could you please elaborate on what you are trying to achieve?

Hi
Let’s take like we have this array variable and pass that variable to a FOR EACH activity and change the type argument as string
—inside the loop use a IF condition like this
item.ToString.Contains(“Data”)
If true it will go to THEN Part where we can use a assign activity like this
str_filepath = item.ToString
And next to this assign activity use a BREAK ACTIVITY

CHEERS @Brian_Henokh1

1 Like

The mark i was created look like on the screenshot that is the folder i want to access. In that folder, there are some files i want to create for my project. But, i can’t access that because i haven’t get the folder index in ArrayList. Can you help me?

Try you can like this Main.xaml (5.0 KB) I hope this will help you.

1 Like

Yah once after getting the folder path like this
In str_filepath then use this in a assign activity next to this For Each loop

Like this
arr_files = Directory.GetFiles(str_filepath)
Which will give us all the files in that folder stored in a array of string which can be iterated and each file path can be obtained by passing them as input to FOR EACH loop again

Cheers @Brian_Henokh1

1 Like

I think you may need to get index of the array which contains "\\Data".
Please try to use code as example below.
Array.FindIndex(arrayString, Function(x) x.Contains("\\Data"))

Code project: https://github.com/akkapolk/Robotic-Process-Automation-UiPath-Test-ArrayFindIndexWithLambdaExpressions00001

Reference: Lambda Expressions - Visual Basic | Microsoft Learn

1 Like