Solved

Get file extensions of all the files on a drive

Posted on 2014-10-31
2
78 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 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
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
Comment Utility
How would I get the distinct values?
thx again
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

8 Experts available now in Live!

Get 1:1 Help Now