0

When you Right-click a file in Windows/File Explorer > Properties > Details, you get a whole lot of useful information about that file.

How can we programmatically access that information in C#?

The only somewhat (no offense) answer I've come across after months of searching for a solution is How do I get details from File Properties? - but that answer was written 4 years ago. There has to be a better way to achieve this goal by now, right?

Community
  • 1
  • 1
jay_t55
  • 11,362
  • 28
  • 103
  • 174
  • Did you also see the answered duplicate that it links too? http://stackoverflow.com/questions/220097/read-write-extended-file-properties-c/2096315#2096315 – Willem van Rumpt Jun 26 '14 at 06:34

1 Answers1

1

Use FileInfo Class.

FileInfo oFileInfo = new FileInfo(strFilename);

Now, with oFileInfo object, you can access file properties.

Ricky
  • 2,323
  • 6
  • 22
  • 22
  • Even File Properties such as Owner, Album Artist, Album, Genre, Length, Publisher, Composers, or Subtitle, Copyright? I use FileInfo all the time and I've never seen that many properties available. – jay_t55 Jun 26 '14 at 06:32
  • Then you have to use shell32.dll. See example here. http://www.codeproject.com/Articles/5036/ID-Tag-Reader-Using-Shell-Functions – Ricky Jun 26 '14 at 06:36
  • Here is another nice example. http://www.codeproject.com/Articles/7987/Retrieve-detailed-information-of-a-File – Ricky Jun 26 '14 at 06:38