-->

文件外存储元数据:在现代的Windows任何标准的方法呢?(Store metadata outsi

2019-08-02 05:00发布

我的C# 应用程序同步从远程文件管理系统的文件到文件系统。

文档管理系统具有与每个文件相关联,但没有存储中的每个文件的元数据(最后审计,保密,作者...的日期)。
这些文件可以是任何东西(BMP,XWD,PDF,未知的二进制)

我想使这些元数据在本地Windows文件系统可见。
但我不能存储元数据中的每个文件。 例如,更改文件的保密不得修改文件的校验和。

什么是存储元数据的最佳方式?

我听说过NTFS 扩展文件属性 ,是它的东西应用于我的场景? 这有关设置扩展文件属性的问题已经谈论修改文件本身,这是我必须避免所有的答案。

如果没有标准溶液,然后我将存储在本地SQLite数据库中的元数据。 但我真的喜欢使用标准的解决方案,使其他应用程序(资源管理器,图库应用等)可显示/修改他们了解的属性(如“作者”)

Answer 1:

备用数据流是NTFS”鲜为人知的特征之一。 从页面引用:

C:\test>echo "ADS" > test.txt:hidden.txt

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is B889-75DB

 Directory of C:>test

10/22/2003  11:22 AM    

. 10/22/2003 11:22 AM
.. 10/22/2003 11:22 AM 0 test.txt

C:\test> notepad test.txt:hidden.txt

This will open the file in notepad and allow you to edit it and save it.

它类似于Macintosh资源叉,也就是说,它允许关联与文件的任意数据,没有它是文件本身的一部分。 资源管理器默认不明白,但你可以写一栏处理它。

编辑

一些元数据(如作者和书名),可以使用保存OLE文档属性 。 我不知道这是否会修改文件本身或没有,但:

private void button1_Click(object sender, EventArgs e)
{
  //This is the PDF file we want to update.
  string filename = @"c:\temp\MyFile.pdf";
  //Create the OleDocumentProperties object.
  DSOFile.OleDocumentProperties dso = new DSOFile.OleDocumentProperties();
  //Open the file for writing if we can. If not we will get an exception.
  dso.Open(filename, false,

    DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess);
  //Set the summary properties that you want.
  dso.SummaryProperties.Title = "This is the Title";
  dso.SummaryProperties.Subject = "This is the Subject";
  dso.SummaryProperties.Company = "RTDev";
  dso.SummaryProperties.Author = "Ron T.";
  //Save the Summary information.
  dso.Save();
  //Close the file.
  dso.Close(false);
}


文章来源: Store metadata outside of file: Any standard approach on modern Windows?