PathExist with wild card


#1

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


#2

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


#3

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?


#4

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…!!


#5

what is random string? wild card?


#6

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.


#7

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


#8

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


#9

Hi,

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

Warm regards,
Lavina


#10

Hi @lavint,

Please check this

Regards,
Yathish