Wildcard file path

Hi all,

problem:
i wish to read a single sheet from each files with path:-

    C:\Users\user\Documents\testenviroment\test_20190715_1220.xlsx
    C:\Users\user\Documents\testenviroment\test_20190714_1420.xlsx
    C:\Users\user\Documents\testenviroment\test_20190713_1020.xlsx
    .
    .
    .
    C:\Users\user\Documents\testenviroment\test_20190715_0820.xlsx

20190715 is about yyyy,mm,dd
0820 is about time now
time now is the one i wish to wildcard, which no algorithm, or tracking part can be used to track it.

for example, in read file, with path “C:\Users\user\Documents\testenviroment\test_todayDate_*.xlsx”

to me, is failed with reason


any solution or suggestion?

1 Like

Hi @damonyl,

you can not use wildcard in file path.
what is your requirement can you elabarate much more. So we can help

@damonyl

We can’t use wildcards in reading file.

Try this way.

    strExcelFiles [] = Directory.GetFiles("C:\Users\user\Documents\testenviroment\","test*.xlsx")

The above expression will read all matching files and will give output as string array. Then use For Each loop activity to read one by one file.

6 Likes

Hi @lakshman, so which activity should i run for this code? assign?

@damonyl

use Assign activity and create one variable of type string array and say strExcelFiles

@lakshman will try this. By the way, i have update my post and more precise. please have a look

1 Like

@venkat4u, try check if you understand my post now. i have update the problem facing

@damonyl

My expression will work for you and just try once.

@lakshman

I’ve tried put it in assign, it turns up

@damonyl

It should be like this:

        Directory.GetFiles("R:\Phil\DB Specifications\", ReportName.Tostring+"_"+Now.Tostring("yyyyMMdd")+"_"+"*.xlsx")
5 Likes

@lakshman got it! thanks! so the comma will be before folder name. thanks again!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.