The File System Task in SSIS allows us to perform Ten types of Operations on Files and Folders. In this article We will show you, How to delete File using File System Task in SSIS with example. To delete Directory, Please refer Delete Directory Using File System Task in SSIS article present in the SSIS page.
TIP: To Delete Multiple files we have to use the For each container.
We have File System Task Folder inside the Music Folder. Below screenshot shows you the data inside that folder. Our task is to delete single file (COUNTRIES LOOKUP.xls) present inside the File System Task Folder.
Delete File Using File System Task in SSIS
In order to Delete File Using File System Task in SSIS, Drag and drop the File System Task into the Control Flow region and rename it as Delete File Using File System Task in SSIS
Double click on it will open the File System Task Editor to configure it.
In this example, We are deleting Single file so, Please change the operation property to Delete File as shown in the below screenshot
Let us configure the Source Connection by selecting the SourceConnection property. If you already created the File Connection Manager before then select the created one or If you stored the Source Connection in the Variable then, please change the IsSourcePathVariable property to TRUE and select the Variable Name.
Here, We haven’t created any connection Manager before so, We are selecting <New Connection..>.
Once you click on the <New Connection..> option, File Connection Manager Editor will be opened to configure it. In this example we are deleting single file so we are selecting Existing File option from the Usage Type
Click on the Browse button to select the Existing File (which is Countries Lookup.xls).
From the above the above screenshot you can observe that, We selected the Excel file called Countries Lookup inside the File System Task Folder
Click Ok to finish configuring the File Connection Manager.
Click Ok to finish configuring File System Task Editor. Let’s run and see whether we successfully deleted the excel file using the File System Task or Not.
Well, We successfully deleted the Countries Lookup file present in the File System Task Folder or Directory.
Thank You for Visiting Our Blog.