Look at the System.IO.Directory
class and the static method GetFiles
. It has an overload that accepts a path and a search pattern. Example:
string[] files = System.IO.Directory.GetFiles(path, "*.txt");
More Related Contents:
- Difference between forward slash (/) and backslash (\) in file path
- Getting current directory in .NET web application
- How can I obtain the case-sensitive path on Windows?
- Search SQL by date ASP.NET
- Get Enum from Description attribute [duplicate]
- Edit a specific Line of a Text File in C#
- Unloading the Assembly loaded with Assembly.LoadFrom()
- How to Get IP Address?
- Has foreach’s use of variables been changed in C# 5?
- How do I convert Unicode escape sequences to Unicode characters in a .NET string?
- POSTing JSON to URL via WebClient in C#
- How do I upload a file to an SFTP server in C# (.NET)? [closed]
- populate treeview from list of file paths in wpf
- Efficient Cartesian Product algorithm
- Detect Windows font size (100%, 125%, and 150%)
- How to make Texture2D Readable via script
- How do I create a generic class from a string in C#? [duplicate]
- Multiple fields validation using Remote Validation
- Can you access UI elements from another thread? (get not set)
- Debug Console window cannot accept Console.ReadLine() input during debugging
- How can I tell Json.NET to ignore properties in a 3rd-party object?
- Why are all the collections in my POCO are null when deserializing some valid json with the .NET Newtonsoft.Json component
- C#: how to get first char of a string?
- How do you convert a string to ascii to binary in C#?
- C# – Can publicly inherited methods be hidden (e.g. made private to derived class)
- Why is EF returning a proxy class instead of the actual entity?
- Could not load file or assembly Windows.winmd’
- How to refresh the windows desktop programmatically (i.e. F5) from C#?
- Specify Date format in MVC5 (dd/MM/yyyy)
- How can I redirect process output (console) to richtextbox?