April 9, 2013 at 11:12 am
Hello All,
I am trying to create an SSIS package that will look at a directory, get a list of all the file names in the directory, and enter them into a table. Any advice to accomplish this?
Thanks!
Robert
April 10, 2013 at 10:12 pm
Use a foreach loop container. This can be used to iterate through files in a folder. In each iteration of the loop, the foreach loop container will assign the filename to a variable. You can then use that variable in an execute sql task to insert the file name into a table.
April 12, 2013 at 9:05 am
OK. I'm familiar with using a for each loop to process all the files in a directory, such as importing flat files into a table. But I'm not familiar with only putting the file names into a variable. Can you provide more information on how to do that?
Thanks
April 12, 2013 at 9:16 am
If you've got a lot of files in your folder, it will probably be more efficient to run a dir statement (or the equivalent in VB or Powershell or your favourite language) to get a list of all files in the folder, and insert that list into your table in one go.
John
April 15, 2013 at 9:32 am
Thanks. There is an average of about 15,000 files in that directory so I went the way of writing a c# script and having it gather all the file names and put them into a txt file that I then use to compare the sql table.
Thanks for the brainstorming.
July 25, 2013 at 1:58 am
Can you send me the code how you accomplish that?
Thank you
Srikanth Kota
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply