public static string[] ReturnFilePathOfPattern(object Pattern) { if (!Directory.Exists(DirectoryS)) { Directory.CreateDirectory(DirectoryS); } List <string> TEMP = new List <string>(); foreach (var Fi in Directory.GetFiles(DirectoryS)) { if (Fi.Contains(Pattern.ToString())) { TEMP.Add(Fi); } } return(TEMP.ToArray()); }