Return number that is not found


Please see attachment. In the directory, there is 22274.xlsx and 22273.xlsx.
But there are no 12345.xlsx, 45678.xlsx and 56789.xlsx For now, the robot shows the 2 excel files that exist and ends the execution with NO error. I’d like the robot to return 12345, 45678 and 56789 when the excel file(s) is/are not found. Can you please give me some hint? Thanks!

Warm regards,

eachDetailLoop - forum.xaml (12.4 KB)


File exists can be used to check whether file exists in the path or not. If not present, return the filename. i.e. 12345.xlsx

Hi @SaranyaKishore,

I understand what you are saying and tried the PathExists method, but I am really not sure where to put the PathExists.

I assigned detailPath = Directory.GetFiles(“\Uipath\Detail\detail-drop”, item + “*.xlsx”)
Then for each item in detailPath
PathExist is true or not. If it’s true, do somethin as in the attached xaml above.

The execution has been ended by itself as the first instance does NOT exists.
My question is, when I assign detailPath as Directory.GetFiles, it has to be existed in order to get it right?

So I now first assign a string = "\Detail\detail-drop" + item + “*.xlsx”

But then all are not exists because Uipath doesn’t read * as a wild card.

Is this the right way to do it? My obstacle is that the path is with string and variable plus wild card.



Edit: I am trying an example now: