string period = "55";
var batchperiod = period.ToString();
Why are you doing this? Calling
ToString()
on a variable which already is a
string
just does not make any sense.
Moreover,
Enumerable.SingleOrDefault Method[
^] throws an exception if there is more than one element in the sequence. Which is the case here, since these lines:
GL_Export_55_201907081053.xml
GL_Export_78_201907081055.xml
both contains the
55
character sequence.
Maybe you need a regular expression to filter the result more acurately?