When you develop a SQL Server Integration Services (SSIS) package, you can usually use the predefined tasks to perform your data extraction, transformation, and loading (ETL) operations. However, there are some actions you can’t accomplish by using the predefined tasks. For these situations, you can often use the Script task to extend SSIS with custom code that runs within the context of the SSIS package.
You can use the Script task to perform many operations, such as querying Active Directory (AD) or monitoring system performance. You can also use the Script task to interface with and act on files and directories. For example, suppose you’re developing an ETL solution that provides data to a series of reports. The ETL operation will pull data from a set of text files saved to a local directory, but the reports should be based only on data that has been generated within the last 48 hours. So before you extract data from those files, you want to delete any files that haven’t been updated within the past two days. To accomplish this operation, you can use the Script task to determine when the files were modified and delete files outside the acceptable range. . . .