Solved

Get file extensions of all the files on a drive

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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