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 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 Delete Directory Content Using File System Task in SSIS article present in the SSIS page.
We have Copied Folder inside the Documents Drive (F). Below screenshot shows you the data inside that folder. Our task is to change the default attributes of the CUSTOMERS.txt File using this 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 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.
Although We created the connection Manager before, Just 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 Existing File option from the Usage Type and Click on the Browse button to select the File.
From the above the above screenshot you can observe that, 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. This will hide the text file
Let us change the ReadOnly Property of a text file to True. This 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
Thank You for Visiting Our Blog.