Delete Directory Using File System Task in SSIS

The SSIS File System Task allows us to perform Ten types of Operations on Files and Folders. In this article, we show you how to delete Directory Using File System Task in SSIS with example.

To delete Directory content, Please refer to Delete Directory Content Using File System article present in the SSIS page.

We have File System Task Folder inside a Music Folder. Our task is to delete the SSIS Blogger pics folder inside that File System Task Folder.

Delete Directory Content Using File System Task in SSIS 2014

Delete Directory Using File System Task in SSIS

To Delete Directory Content Using File System Task in SSIS, Drag and drop the File System Task into the Control Flow region. Next, rename it as Delete Directory Using File System Task

Delete Directory Using File System Task in SSIS 1

Double click on it will open the File System Task Editor to configure it.

In this example, We are deleting the directory. So, Please change the operation property to Delete Directory

Delete Directory Using File System Task in SSIS 2

Let us configure the Source Connection by selecting the SourceConnection property. If you previously created the File Connection Manager, select the same. Or if you stored the Source Connection in a Variable, please change the IsSourcePathVariable property to TRUE and select the Variable Name.

Although We created the connection Manager before, to show you the steps, We are selecting <New Connection..>.

Delete Directory Using File System Task in SSIS 3

Once you click on the <New Connection..> option, File Connection Manager Editor opened to configure it. Here, we are deleting a directory, so we are selecting Existing Directory option from the Usage Type

Delete Directory Using File System Task in SSIS 4

Click on the Browse button to select the Existing Folder.

Delete Directory Using File System Task in SSIS 5

From the above screenshot, you can see we selected the SSIS BLOGGER pics folder inside the File System Task Folder

Delete Directory Using File System Task in SSIS 6

Click Ok to finish configuring the File Connection Manager.

Delete Directory Using File System Task in SSIS 7

Click Ok to finish configuring Delete Directory Using File System Task in SSIS. Let’s run and see whether we successfully deleted the Directory using the File System Task or Not.

Delete Directory Using File System Task in SSIS 8

Well, We successfully deleted the directory present in the File System Task Folder or Directory.

Delete Directory Using File System Task in SSIS 9