How to merge pdf files with same file name

Guys I have a folder contains many PDFs with similar file name like (8020-2021, 8020-2022, 8020-2023) i want to merge all the PDF with same 8020 in a sequence when i open result pdf it shows 2021,2022,2023 sequentially and the file name will 8020. How i do it in UiPath suggest me a entire method

The easiest way would be using Team.PDF.Extensions.Activites library and “Merge PDF Files” activity.

  1. Retrieve the list of all files to merge (i.e., 8020-2021, 8020-2022, 8020-2023)
  2. Find the name corresponding to each group of files by using a command similar to this:
    yourListOfFileNames.Select(Function (fileName) fileName.Split("-")(0)).Distinct.ToList()
    This will give you the future file names (8020, …)
  3. Loop through this collection
  4. For each item, find the files to merge together by searching for all files that start with that key:
    yourListOfFileNames.Where(Function (f) f.StartsWith(currentItemInTheLoop)).ToList
  5. Use this list as input for the Join PDF Files activity
1 Like


  1. Arrayfiles = Directory.getfiles("folderpath","*commonname*")
  2. Next part is here…just pss the arrayfiles to the activity


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.