Directory.getdirectories(folder) returns the array of strings
If i understand your requirement correctly then your condition is like you need to find files inside folder which are start with variablename(?)
If it is so then you just need to following
Arraypath = directories.getdirectories(folder)
Foreach path in arraypath
If path.startwith(variablename)
//Correct file
Else
//Check next path