Need to read a file with only a partial name known (asterisk help)

So title is really pretty accurate. I have a naming convention that has run into its first issues. Files are saved to the server in the following pattern.

123 xyz 123
st.txt
sn.txt
sl.jpeg
321 xyz 123
st.txt
sn.txt
sl.jpeg
etc....(the 123... is the folder the files are in on the server)

Anyway, heres my problemo. I know that I want 123, and 123 is a unique identifier, but I don’t know how to wildcard the rest. I would love to be able to do something along the lines of

File.ReadAllLines(Application.persistentDataPath+"123 * st.txt")

but thats not working for me right now. Any tips would be appreciated.

So, if 123 is a directory and you want to access files in that directory, you need to add a forward slash (/) after it. So the line would look like this:

 File.ReadAllLines(Application.persistentDataPath+"123/*st.txt")

Another way would be using Path.Combine:

 File.ReadAllLines(Path.Combine(Path.Combine(Application.persistentDataPath,"123"), "*st.txt"))

In fact, you should use Path.Combine, because of different behavior on different operating systems and Path.Combine handles it all.

So the wildcard is in the directory name?

using System.IO;

string[] dirs = Directory.GetDirectories( Application.persitantdatapath, "123*" );
foreach (string s in dirs )
{
  Debug.Log(s);
}

Use Directory.GetFiles() to find files with wildcard.