Second method - using the group by approach (nested looping is not required)
(
From arr In Directory.GetFiles(RootFolderPath, "*.txt", SearchOption.AllDirectories).Select(Function(fp) fp.Split("\"c).Reverse.Take(3))
Group arr By
k1 = arr(2),
k2 = arr(1)
Into grp = Group
Let TArr = grp.Select(Function(gp) gp(0).Split("T"c).Last.Substring(0,8)).OrderBy(Function(g) CInt(g.Replace("_","")))
Select dt_Out.Rows.Add(New Object() {k1.Split("@"c).First.ToUpper.Replace(".", " "), k2.Replace("_", "-"), TArr.First.Replace("_", ":"), TArr.Last.Replace("_", ":")})
).CopyToDataTable
xaml
DateTimeTADK_v2.xaml (8.6 KB)