Search file from a string variable with filter

Hi all!

I edit to clarify the question.

i need to get a file name from a directory where there are so many files. The file name i need contains the current date (yyyymmdd) as a part of name from the file.
i tried with the assign task for the directory but i dont know what method to use with for each task to obtain the correct file name.
perhaps i am focusing a wrong way?

please could you help me with this?

        thank you very much.
1 Like

Hi,

you could use a directory.getfiles command to pass the folder contents into a string array. from there on, a basic “for each item” would retrieve the full file path (which can be afterwards checked with a string method)

teo

1 Like

Hello @cacafundi

Please find the following attached sample: fileswithnamessample.xaml (6.5 KB)

This will get all filename from particular directory having the currentdate string in file name like file_20170509.xlsx

Directory.EnumerateFiles("D:\Test", "*"+DateTime.Now.Date.ToString("yyyyMMdd")+"*.xlsx", SearchOption.AllDirectories)

Regards…!!
Aksh

7 Likes

Hi folks,

i can’t believe it aksh1yadav it works!! thanks for your help and your time!!
as always you make possible the magic!!:heart_eyes: :notes:

Thanks to all

BR.

1 Like

:slight_smile: :smile: Thanks… pleasure is all mine :slight_smile:

Regards…!!
Aksh

1 Like