Get a file by filename from folder

Hello everyone!
I would like to get a file by filename from a folder and upload the file. What is the easy way to do?
Unfortunately, my solution is a bit slow, so looking for something nicer and easier.

string searching_file=“2018-20”
var files= Directory.GetFiles(path)
foreach item in file
fileInfo=new FileInfo(item.ToString)
fileName=fileInfo.Name
if fileName.Contains(searching_file)

Thank you!

@anudar.dorjgotov
give a try on:
Directory.GetFiles(path, *2018-20*)

1 Like