Answered by:
SSIS For Each Loop Container

Question
-
Hello All,
I have some files within sub folders. Below is the layout
C:\Source\01012015\Sample_1.csv
C:\Source\01012015\Sample_2.csv
C:\Source\02012015\Sample_1.csv
C:\Source\02012015\Sample_2.csvC:\Source\03012015\Sample_1.csv
C:\Source\03012015\Sample_2.csvI want to copy entire folder contents from source to destination including the sub folders and the files
I am using for each loop container which reads the files form 01012015 folder, is there any way to read all the files from each and every folder(01012015, 02012015,03012015)?
The destination should be like this.
C:\Archive\01012015\Sample_1.csv
C:\Archive\01012015\Sample_2.csv
C:\Archive\02012015\Sample_1.csv
C:\Archive\02012015\Sample_2.csvC:\Archive\03012015\Sample_1.csv
C:\Archive\03012015\Sample_2.csv
Thanks, Shyam.
- Edited by ShyamReddy Thursday, April 2, 2015 5:40 PM
Thursday, April 2, 2015 4:36 PM
Answers
-
- Proposed as answer by Katherine Xiong Friday, April 3, 2015 8:19 AM
- Marked as answer by Katherine Xiong Friday, April 10, 2015 2:10 AM
Friday, April 3, 2015 1:05 AM -
Hi Shyam,
According to your description, you want to copy entire folder contents including the sub folders and the files from source to destination.
Based on my research, we should use Foreach File Container together with File System Task to achieve your requirement. For more details, please refer to the following links:
https://social.msdn.microsoft.com/forums/sqlserver/en-US/4d99ebef-df43-44ad-9794-1d729cbf52e9/ssis-foreach-loop-copy-within-subfolders
http://www.sql-programmers.com/for-each-loop-container.aspxThanks,
Katherine XiongKatherine Xiong
TechNet Community Support- Proposed as answer by Katherine Xiong Wednesday, April 8, 2015 7:55 AM
- Marked as answer by Katherine Xiong Friday, April 10, 2015 2:09 AM
Friday, April 3, 2015 9:14 AM
All replies
-
-
Sorry, the source name is same, only the folder name changes.
Thanks, Shyam.
Thursday, April 2, 2015 5:40 PM -
- Proposed as answer by Katherine Xiong Friday, April 3, 2015 8:19 AM
- Marked as answer by Katherine Xiong Friday, April 10, 2015 2:10 AM
Friday, April 3, 2015 1:05 AM -
Hi Shyam,
According to your description, you want to copy entire folder contents including the sub folders and the files from source to destination.
Based on my research, we should use Foreach File Container together with File System Task to achieve your requirement. For more details, please refer to the following links:
https://social.msdn.microsoft.com/forums/sqlserver/en-US/4d99ebef-df43-44ad-9794-1d729cbf52e9/ssis-foreach-loop-copy-within-subfolders
http://www.sql-programmers.com/for-each-loop-container.aspxThanks,
Katherine XiongKatherine Xiong
TechNet Community Support- Proposed as answer by Katherine Xiong Wednesday, April 8, 2015 7:55 AM
- Marked as answer by Katherine Xiong Friday, April 10, 2015 2:09 AM
Friday, April 3, 2015 9:14 AM