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
Before creating the package, Let us show you the default attributes of the Customers.txt file
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
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
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..>.
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.
From the above screenshot, we selected the customers text file inside the Copied Folder.
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
Let us change the ReadOnly Property of a text file to True. It will not allow us to alter the text file
Click Ok to finish configuring File System Task Editor.
Let’s run and see whether we successfully changed the attributes of a given file using the File System Task or Not.
Well, We successfully changed the attributes