I need to accomplish the following tasks:
1) Detect a new zip file in a designated folder
Do you think that I can use WMI Event watcher task and WMI Data read task to do these?
You should be able to use the WMI Event Watcher Task - but the main purpose of this task is to "wait" until a file is detected, and "then" do something. If you're just running your package manually or on a schedule, and wanting it to do something with files in a folder that weren't there last time you ran the package, you don't want the WMI Event Watcher Task.
In order to "detect" files, you can use the Foreach Loop Container to iterate over all the files in the folder, then inside the loop, determine if the file is "new" (however you determine that). If you want to know file modification dates, you can use a Script with the System.IO.FileInfo namespace, or use the File Properties Task.
To unzip files, you can use the Script Task and public code like SharpZip, or you can use one of the compression tasks found on the SSIS Community Tasks and Components site.
Once you have your files located/detected, and extracted, you'd use a Data Flow Task to read them in to update/replace data in a database.
answered Apr 26 '10 at 06:09 PM
Thank you very much for your reply. I have a WMI Event Watcher Task to watch the folder, and then a script task to do unzip. It works fine when it starts from Visual Studio project. I start with the wmi event watcher task , it turns yellow, kind of waiting, after I drop the new zip file in the designated folder a few seconds later, it turns to green and proceed to unzip task, and it unzip the zip file. But, when I set up this as a job in SQL Server Agent, run it every minute, it ran through steps with no error, but did not unzip the file. How can I set up WMI task, so it watches the folder wait until a new zip file coming, then proceed to other steps?
answered Apr 27 '10 at 11:12 AM