I am trying to load a file that I know part of the name (and know that it will be uniquely identified by the part that I know.)
Here is the jist of it:
string fileName = ID + " - " + Env + " - ";
byte[] buffer;
using (FileStream fileStream = new FileStream(Server.MapPath("~") +
fileName + "*", FileMode.Open))
{
using (BinaryReader reader = new BinaryReader(fileStream))
{
buffer = reader.ReadBytes((int)reader.BaseStream.Length);
}
}
Line 4 is where I need help. If I say fileName+"*" then I will get "ID - Env - *" instead of a wildcard matching any file after "ID - Env -" (I have real vars for ID and Env, they are just no shown here.)
Is there any way to say "match on any file that fits the beginning"?
(I am using VS 2008 SP1 and .NET 3.5 SP1)
Thanks for any help.