Solved

Get file extensions of all the files on a drive

Posted on 2014-10-31
2
82 Views
Last Modified: 2014-11-01
How can I write a program to transverse/recusive a drive  (C:\) and return a list of all the file extensions?

I know I can use Path.GetExtension
0
Comment
Question by:JElster
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40416921
using System.IO;

...

foreach (string filename in Directory.EnumerateFiles(@"C:\", "*.*", SearchOption.AllDirectories))
{
    Console.WriteLine(Path.GetExtension(filename));
}

Open in new window

0
 
LVL 1

Author Comment

by:JElster
ID: 40417118
How would I get the distinct values?
thx again
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now