Setting Attributes Using File System Task in SSIS

In this article, we show you how to Set the Attributes for files and folders in the File system Using SSIS File System Task with example. To delete the Directory Content, Please refer to Delete Directory Content Using File System Task article present in the SSIS page.

We have Copied Folder inside the Documents Drive (F). Our job is to change the default attributes of the CUSTOMERS.txt File using this SSIS File System Task

Setting Attributes Using File System Task in SSIS 0

Before creating the package, Let us show you the default attributes of the Customers.txt file

Setting Attributes Using File System Task in SSIS 1

Setting Attributes Using File System Task in SSIS

For setting attributes using File System Task in SSIS, Drag and drop the File System Task into the Control Flow region and rename it as Set Attributes Using File System Task in SSIS

Setting Attributes Using File System Task in SSIS 2

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

In this example, We are changing the attributes of a single file. So, please change the operation property to Set Attributes

Setting Attributes Using File System Task in SSIS 3

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.

Though we have already created the connection Manager, to show you the steps, we are selecting <New Connection..>.

Setting Attributes Using File System Task in SSIS 4

Once you click on the <New Connection..> option, File Connection Manager Editor will be opened to configure it. Please select the file you wish to alter the attributes.

In this example we are altering the customers text file. So we are selecting the Existing File option from the Usage Type and Click on the Browse button to select the File.

Setting Attributes Using File System Task in SSIS 5

From the above screenshot, we selected the customers text file inside the Copied Folder.

Setting Attributes Using File System Task in SSIS 6

Click Ok to finish configuring the File Connection Manager.

Let us change the Hidden Property of a text file to True. It hides the text file

Setting Attributes Using File System Task in SSIS 7

Let us change the ReadOnly Property of a text file to True. It will not allow us to alter the text file

Setting Attributes Using File System Task in SSIS 8

Click Ok to finish configuring File System Task Editor.

Setting Attributes Using File System Task in SSIS 9

Let’s run and see whether we successfully changed the attributes of a given file using the File System Task or Not.

Setting Attributes Using File System Task in SSIS 10

Well, We successfully changed the attributes

Setting Attributes Using File System Task in SSIS 11