SSIS - 13 or more different files from the same directory

Naomi Nosonovsky 8,371 Reputation points
2025-04-29T13:21:46.0233333+00:00

Good morning,

I'm trying to figure out a best SSIS solution for the following problem. I have 13 or more input files of different structure. I already designed 13 data flow tasks for these text files and I used string variables file1, file2, etc. for connection string property for each of these files. However, right now the names are hardcoded. I want to automatically assign the names based on each file pattern, say, adr_.txt, adrlang_.txt, etc.

What would be the best way to achieve this functionality?

I have another question for the same files. All of them have a footer in the format of 99|00000630

where 630 will be the number of rows. How do I design the file connection for the footer and do I need 13 separate flat file connections?

Thanks in advance.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,687 questions
0 comments No comments
{count} votes

Accepted answer
  1. Azar 28,155 Reputation points MVP Moderator
    2025-04-29T20:12:32.4766667+00:00

    Hi there Naomi Nosonovsky

    Thanks for using QandA platform

    You can use a Foreach Loop Container in SSIS to loop through files matching patterns like adr_*.txt, storing the path in a variable and using expressions to set each connection's ConnectionString. Since the file structures differ, you’ll still need 13 separate Flat File Connections. For footers like 99|00000630, handle them in a Script Component by skipping rows that start with 99|, or preprocess the file in a Script Task to remove the footer before loading.

    If this helps kindly accept the answer thanks much


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.