updating file custom properties

  • Hi All,

    i have an SSIS package that loops round a recordset, it takes a file name and path and copies it into other directories, updates a DB entry and a few other things.

    this is working great.

    however, there is one more thing that i have to do to the file within the package.

    this is to update a custom propery of the file.

    the file has a custom property of 'DateApproved' and i need to set this to todays date.

    i have looked at the filesystemtask and the attributes you can update there are minimal.

    does anyone have any advice/ideas on how to do this?

    thanks

    Ian.

  • i.campbell (7/6/2012)


    Hi All,

    i have an SSIS package that loops round a recordset, it takes a file name and path and copies it into other directories, updates a DB entry and a few other things.

    this is working great.

    however, there is one more thing that i have to do to the file within the package.

    this is to update a custom propery of the file.

    the file has a custom property of 'DateApproved' and i need to set this to todays date.

    i have looked at the filesystemtask and the attributes you can update there are minimal.

    does anyone have any advice/ideas on how to do this?

    thanks

    Ian.

    I think you'll have to use a script task to do this - I've done similar in the past (though not with custom properties, I'll admit).


  • Ah ok... do you have any script code i could look at to fathom how to do this?

    thanks

    Ian.

  • i.campbell (7/6/2012)


    Ah ok... do you have any script code i could look at to fathom how to do this?

    thanks

    Ian.

    It was in a previous role and I don't still have the code.

    But you can do stuff like this in your (C#) Script Task:

    string path = @"c:\temp\Test.txt";

    File.SetAttributes(path, FileAttributes.Normal);

    Good look.


  • this was an interesting article on setting custom file attributes;

    http://blog.rodhowarth.com/2008/06/how-to-set-custom-attributes-file.html

    i found it interesting that you can set attributes on non- MS Office files, and the attribute stays as long as the file is on an NTFS system; read the comments in the blog.

    you need the DSOFile.dll to do this, I guess.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks, i will give this a good read next week, but it sounds like just the job.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply