How to get specific file in the folder

I have many csv files in the folder i have to fetch a specific file like “bill date” how to get file.
date is always changing.
help me to do this task…
Wildcard is not accepting in string.

@ravi_gupta,

You can fetch files data using Directory.GetFiles(“folder path”).ToString) and validate your file name accordingly and read that file only.

1 Like

Can u please tell me how to validate . Or give the condition like i have to fetch like “some_name date”
Example: all 12/04/2018.
All is common factor in this … it will not change only date will change then how can i fetch that file in multiple files

Hi…

You can use the assign activity to get it done. In assign activity under the value propery provide the below…

Directory.GetFiles("C:\temp\","*.csv")

This will get any files in the folder with the extension .csv

Hope it helps…

5 Likes

I have tried this to…but its showing illegal character used

Can you share a screenshot of that activity along with the command you use to get files… and also the exact error message…

This is often because people use “ instead of "

1 Like

Hey @ravi_gupta

Here is a detailed article on that :slight_smile:

1 Like

Hi Ravi,

Considering the Example: all 12/04/2018.if the date for the file is current date then you can pick today’s date
Directory.GetFiles(“D:\Rajan\FileName_”+Today.ToString+".csv")

1 Like