471,353 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,353 software developers and data experts.

File Type

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?
Dec 21 '05 #1
1 981
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?
Dec 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by matt | last post: by
3 posts views Thread by Shapper | last post: by
4 posts views Thread by Jim Michaels | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.