Join

How to Get all the files from a folder and join them and then write the final join data into a file.

look like a duplicate of:

@Kailash_Singh

  1. For each file in folder
  2. If excel inside loop use excel file with currentfile.FullName
  3. Merge datatable and merge the read table into a final table
  4. After loop write mergedfinaltable to file again

Cheers

@Kailash_Singh

  1. Get all files from a folder: Use the “Directory.GetFiles” method to get a list of all files within a specified folder. You can specify a directory path and a search pattern to filter specific files if needed.

  2. Join the files: Iterate through the list of files obtained in step 1, and use activities such as “Read Text File” to read the content of each file. Then, concatenate the contents of all files into a single string variable.

  3. Write the final joined data into a file: Once you have the concatenated content of all files, use the “Write Text File” activity to write this content into a new file.

  4. Assign → filesArray = Directory.GetFiles(“C:\YourFolderPath”)

  5. Assign → joinedContent = String.Join(Environment.NewLine, filesArray.Select(Function(file) File.ReadAllText(file)))

  6. Write Text File:

  • File path: “C:\YourOutputFolderPath\output.txt”

  • Text: joinedContent

Make sure to replace “C:\YourFolderPath”, “C:\YourOutputFolderPath\output.txt”, and any other placeholders with the actual paths you’re working with.