none
Need to add a new file attribute RRS feed

  • Question

  • Hi,

    Is it possible to create a new file attribute? By file attribute I mean the ones similar to Create Date, Modified Date, Version, etc.

    My requirement is to create a checksum using the file content and store it as one file attribute. We use this to validate the integrity of the file contents.

    Regards,

    Asim.

    Tuesday, June 26, 2012 1:13 PM

Answers

  • The short answer is probably not.

    If the file format permits, you can store the checksum in the data.  This may not work for you since not every file format allows for attributes.  For example, docx will, but txt does not.

    The other alternative would be to store the checksum in an alternate file stream.  Alternate streams have their own drawbacks.  The most important being that depending how a file is transferred, the alternate stream may not be preserved.


    This signature unintentionally left blank.

    • Marked as answer by Asim Patnaik Wednesday, June 27, 2012 4:39 AM
    Tuesday, June 26, 2012 4:20 PM
  • I second the alternate file stream.  But just a note:  The alternate file stream is lost due to the destination file system as long as you use standard copy procedures.  I imagine that if you open the file and read the bytes and write them to an alternate location then yes, the alternate file stream will not accompany.  But under normal copy operations, the reason why it is lost is Destination file system.

    Jose R. MCP
    Code Samples

    • Marked as answer by Asim Patnaik Wednesday, June 27, 2012 4:39 AM
    Tuesday, June 26, 2012 4:35 PM

All replies

  • The short answer is probably not.

    If the file format permits, you can store the checksum in the data.  This may not work for you since not every file format allows for attributes.  For example, docx will, but txt does not.

    The other alternative would be to store the checksum in an alternate file stream.  Alternate streams have their own drawbacks.  The most important being that depending how a file is transferred, the alternate stream may not be preserved.


    This signature unintentionally left blank.

    • Marked as answer by Asim Patnaik Wednesday, June 27, 2012 4:39 AM
    Tuesday, June 26, 2012 4:20 PM
  • I second the alternate file stream.  But just a note:  The alternate file stream is lost due to the destination file system as long as you use standard copy procedures.  I imagine that if you open the file and read the bytes and write them to an alternate location then yes, the alternate file stream will not accompany.  But under normal copy operations, the reason why it is lost is Destination file system.

    Jose R. MCP
    Code Samples

    • Marked as answer by Asim Patnaik Wednesday, June 27, 2012 4:39 AM
    Tuesday, June 26, 2012 4:35 PM
  • Thanks for the responses. I am not sure about what an alternate stream is :( I will do some study and try to figure that out.

    Regards,

    Asim.

    Wednesday, June 27, 2012 4:39 AM