File Type

  • Thread starter Thread starter Karl Richards
  • Start date Start date
K

Karl Richards

I'm trying to find out how to get the file type (like in Explorer) for each
file within the directory.

Is there a relatively easy way to make that happen?
 
you can use:
string filename = @"c:\test.txt";
System.IO.Path.GetExtension(filename);

returns ".txt" if you just want the extension part use:
System.IO.Path.GetExtension(filename).Trim('.');


What kind of File Type are you looking for?
 
Back
Top