string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string source_folder = Path.Combine(desktop, "source_folder");
if (Directory.Exists(source_folder))
{
Directory.GetFiles(source_folder).ToList()
.Where(file => file.EndsWith(".txt")).ToList()
.ForEach(x => Console.WriteLine(x));
}
Wednesday, June 17, 2026
C# Filter files - Get a list of text files in a folder
The following LINQ technique simplifies the code to filter files in a folder.
Subscribe to:
Post Comments (Atom)
Hot Topics
-
In previous post , we learnt basic introduction to SQL Server . In this post we will learn about SSMS (SQL Server Management Studio) softwar...
-
In the previous post we have learnt about SSMS (SQL Server Management Studio) and how to connect with a SQL Server instance. In this post w...
-
By Ajeet Kumar RADAR CHART In radar chart, the categorical variable is displayed as spikes radiating from a central point. The values o...
No comments:
Post a Comment