开发者

Is it possible to add custom metadata to file?

开发者 https://www.devze.com 2023-01-07 03:00 出处:网络
I know that each file has metadata like title, subj开发者_如何学运维ect, keywords and comments:

I know that each file has metadata like title, subj开发者_如何学运维ect, keywords and comments:

Is it possible to add custom metadata to file?

But what if I need custom metadata like tags for example?

Is it possible to do it with C#?


I know that each file has metadata like title, subject, keywords and comments

That is not true. Most file types do not have a 'standard' form of metadata.

In particular, PDF files don't have properties that Windows Explorer recognizes.

Metadata (file attributes) is not a function of the filesystem.

  • Office files use a structured format that allows for such attributes.
  • Jpeg ues EXIF, a different format


If using NTFS you can store whatever you like in an Alternate data stream


As per Jesper's comment, you can use the DSOFile library to read and write to Custom properties that are stored in ADS.
Works well for me though note the fact that the properties are lost when file is transferred to a different file system, including email. see http://www.keysolutions.com/blogs/kenyee.nsf/d6plinks/KKYE-79KRU6 for a 64bit implementation, link to MS original and comments.


This will depend on whether the file type you are working with supports this. For example this will not be possible with a text file.


Has anyone thought of using the File ID for this? You can get it via the command

fsutil file queryfileid "C:/my/path/example.txt"

This could be used to store information about this file in a separate storage-file associated with the id.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号