I have a folder location corresponding to the variable "path". In this folder, I have a lot of files, but only one called "common.build.9897ytyt4541". What I want to do is to read the content of this file, so with the following, it's working :
string text = File.ReadAllText(Path.Combine(path, "common.build.9897ytyt4541.js"));
The problem is, that the part between "build" and "js", change at each source code compilation, and I am getting a new hash, so I would like to replace the previous code, to have something working at each build, whatever the hash is, I thought to regex but this is not working :
string text = File.ReadAllText(Path.Combine(path, @"common.build.*.js"));
Thanks in advance for your help
Path.Combine()Directory.GetFiles(path, @"common.build.*.js")would list matching files, if your positive there will only be one.First()will return it.