Merge Files with those conditions

Hi wall,

I have a folder with differente files.

I need to merge files for all first that thats equal (yellow marked) into a single file with those letters (NS, SN, RT)

So the output will be something like.

2300 - SN-NS-RT ****
2350 - SN-NS-RT ****
And so on.

@Meu_Eu_Nando

ok so first group all your files with the same number that can be done using the following linq Listfiles is a list of files i got using directory.getfiles()

ListFiles.AsEnumerable().GroupBy(Function(file) System.Text.RegularExpressions.Regex.Match(Path.GetFileName(file), "^\d+").Value).ToList()

after grouping take the output to a for each loop or you can use the expression directly in the for loop within the for loop take another for loop that would loop within the group.

use read range and merge datatable activity within the nested for loop and write range in the first for loop.


image
image

1 Like