Abhishek14
(Abhishek Kommera)
January 15, 2020, 9:26am
1
hi,
I have a folder (Named Pay) that contains some pdf files the names of the files are
{A001_Pay.pdf, A002_Pay.pdf, A003_Pay.pdf……}
I have another folder (Named Sal) that contains some more pdf files the names of the files are
{A001_Sal.pdf, A002_Sal.pdf, A003_Sal.pdf……}
I have to match the file name Like A001_Pay.pdf with A001_Sal.pdf…if found then merge those files
Matching file names apart from "Pay " and “Sal”.
2 Likes
Hi @Abhishek14
You can use two assign activities to first read the files available in the two folders into two arrays
Ex:
PayFolderArray = Directory.GetFiles(“<< PayFolderPath>>”)
Now, use a for each activity to loop through the items one array.
Inside that loop, place another loop to loop through the items of the other array.
here, both loops will have the item variable. make sure to rename them into two different names else it will face errors.
Now, inside the second loop, place two assign variables to get the file names of the item variables of both loops
PayFile = Path.GetFileNameWithoutExtension(item.ToString)
SalFile = Path.GetFileNameWithoutExtension(item1.ToString)
now use an IF condition to check whethether the file names match. Here, we need to split both file names from the “_” character to get the matching part of the name
IF PayFile.Split("_"c)(0).ToString.Equals(SalFile.Split("_"c)(0).ToString)
now, if matched, you can place the pdf file merge activity that comes under uipath PDF activities to merge the files
6 Likes
Abhishek14
(Abhishek Kommera)
January 15, 2020, 12:20pm
3
hi
Thanks very much for the solution but I have problem in merge activity…
but then I tried join pdf activity it worked…
1 Like
system
(system)
Closed
January 18, 2020, 12:20pm
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.