Hi how do i read file with dynamic filename? In ssis for importing csv data to my database.
The csv file naming convention can be like: File-ddmmyyyyhhmmss.txt
can anyone advise?
Hi how do i read file with dynamic filename? In ssis for importing csv data to my database.
The csv file naming convention can be like: File-ddmmyyyyhhmmss.txt
can anyone advise?
Steps for dynamically load the flat file into the destination.
Foreach loop containerForeach File Enumerator and
Configure as follows. Folder: Location of your source files
Files : File-*.txt [Since your file naming is something like File-ddmmyyyyhhmmss.txt]
Retrive File Name : Select Fully qualified Name [which brings entire location of your file]

Variable Mapping, Create a variable to store the Full file path
and configure as shown in the screenshot.
Flat file connection using sample file.properties. Find the expression property
and map the variable to the connection string as shown in the
following screenshot.

Important Note:
If you want to validate the file name and existence of the file name before loading into the destination table. Use the script component inside the For each loop container and validate.
Hope this helps.
Here's a step by step guide
Foreach Loop Container (File Enumerator type) , set your Files mask as File-??????????????.txtScript Task inside this container to parse the string variable to match the actual file naming convention (hint: use regex). Any successful matches will act like a filter larger list of files found by the Foreach Loop Container.Refer this learning series from Microsoft: