Custom File Properties

What is a File?

Basically, a file is just a stream of bytes and some metadata that file file system associates with it. In early file systems the metadata was basically just the file name and some date stamps. Newer file systems like NTFS have the option of adding extra metadata.

Where do Document Properties Come From?

In Windows Explorer you can see quite a lot of document properties for many file types. The nice, unified interface suggests that there is some unified property store. That's not really the case. The Explorer Shell has an extensible interface for Property Sheet Handlers that extract this information from various file types. There is a handler for JFIF (JPEG) files, and there are handlers for OLE files (old Office formats), and the new Office formats too.

Where Should I Put My Metadata?

The conclusion is:

  • If you can guarantee that you only need to handle certain file formats, investigate adding the metadata within the files. For example,

    • OLE properties if all your files are old-style Office documents (.doc)

    • Using the Open XML API if all your documents are new-style Office documents (.docx)

  • If you can guarantee that all installations will be on a specific file system, investigate features of the file system. Other responses have considered how you could do this with NTFS.

  • Otherwise you must devise your own data store. Companion files are an obvious possibility; you could store the metadata in a database; or you could create one file per directory to hold all the metadata for files in that directory. Consider whether you might face concurrency problems with multiple requests for the same file. Using a database might make dealing with that more straightforward.


An alternate data stream will allow you to store any data that you want. Beware; if you copy the file to a non NTFS file system, the extra data will get stripped out.

Here is an article that should get you started

-- Edit 1/2/2014 --
Here are some more: http://www.codeproject.com/Articles/2670/Accessing-alternative-data-streams-of-files-on-an http://www.dreamincode.net/forums/topic/90666-reading-and-writing-alternate-streams-in-c%23/ NTFS Alternate Data Streams - .NET

And one for creating/viewing ADS from the command line: http://www.undermyhat.org/blog/2012/05/copy-delete-or-rename-alternate-data-streams-using-only-standard-windows-command-prompt-tools/


Though any kind of file can be opened using DSOFile.dll, custom properties will not be persisted, except for files that are OLE Structured Storages / Ole Documents (http://en.wikipedia.org/wiki/COM_Structured_Storage) like older formats of Microsoft Office files (.doc, .xls, etc) and some CAD files.

As Brad wrote, you can go with alternate data streams, but that has a dependency too, the NTFS file system.

I don't recommend you to go these ways...

What if you used a new file ie. <original file>.props or such?