Last active
March 31, 2023 11:02
-
-
Save alvarosinmarca/e4852d89bdf35c6ad3b6c0560aa63c46 to your computer and use it in GitHub Desktop.
GetExtensionsInFolder with C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pathSelected = "D:\\TORRENTS"; | |
DirectoryInfo directorySelected = new DirectoryInfo(pathSelected); | |
var filesInfo = directorySelected.GetFiles("*", SearchOption.AllDirectories).ToList(); | |
List<string> extensions = new List<string>(); | |
foreach (var file in filesInfo) | |
{ | |
if (!extensions.Contains(file.Extension)) | |
{ | |
extensions.Add(file.Extension); | |
Console.WriteLine(file.Extension); | |
} | |
} | |
Console.ReadLine(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment