PathExist with wild card

Hi,

I have this forloop looping a list of numbers
and the files contain a number + some random string + .xlsx

image

doesn’t work. item is the number

Thanks in advance

Lavina

Hi @lavint… Try item.tostring in the path details

Hi,

Sorry, what I mean it doesn’t work is that the wild card * doesn’t work.
it will print as 11111*.xlsx instead of being a wild card. Any idea how to fix it?

Hi @lavint ,

Can you check if you can pass the random string to some variable and then pass to path. Let me know if it works.

Thanks…!!

what is random string? wild card?

Hi…
" number + some random string + .xlsx "

I meant, if you are not aware of the random string, get the string value in a variable and provide the variable in the path.

Hi Lavina,

Path Exists activity will check for the exact path or file if exists or not, it does not support wildcards.

For your project, you can use the .Net method GetFiles from System.IO.Directory type. This methods returns a list of string with all files names inside a directory and you can specify a filter using wildcards.

Regards
Silviu

3 Likes

Hi @Silviu,

Thanks for your response. I am aware of directory.getfiles. The issue is that there are for example 1000 files in the directory - I only need certain files and some files that I need may not exist, so I was thinking if it was possible to use the string array that I have to check if the path exists first, then get file. And the file path consists a variable string and whatever follows(wild card) + .xlsx. Anyways thanks for the confirmation.

Warm regards,
Lavina

Hi,

The problem is I need wild card. Thanks for trying though.

Warm regards,
Lavina

1 Like

Hi @lavint,

Please check this

Regards,
Yathish

Hi @lavint, have you solved this out?

Just solved out, if need help, refer here: Wildcard file path