question

Mrs_Fatherjack avatar image
Mrs_Fatherjack asked

SSIS - Change file properties

I don't know if this is possible but . . . . I am writing an SSIS package to move files and process data. One of the steps needs to make some files (.DBF) read only, is this something I can do using SSIS or is there a better way of doing it and then just calling it from the SSIS package. Many thanks in advance
ssisfilescript-task
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aRookieBIdev avatar image
aRookieBIdev answered
It is possible using a script task component in the ssis package itself.Once when you moved the file, write a script component task , some c# code to change the file properties. File.SetAttributes("c:/ example.txt",FileAttributes.ReadOnly);
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mrs_Fatherjack avatar image Mrs_Fatherjack commented ·
Many thanks for this, I don't know any c# but this got me thinking so I looked up the equivalent in VB which is: SetAttr("FileName", FileAttribute.Normal) and now I can add this in to my script task of the package.
1 Like 1 ·
aRookieBIdev avatar image aRookieBIdev commented ·
Thank you.Glad that it was useful to you.
0 Likes 0 ·
Cyborg avatar image
Cyborg answered
Powerhsell is a better option when you deals with files.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mrs_Fatherjack avatar image Mrs_Fatherjack commented ·
OK, I'm going to an Introduction Powershell session courtesy of SQL South West and SQLVariant this week so will hold this off until after then. Many thanks.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.