C# get all files in directory
string[] allfiles = Directory.GetFiles("path/to/dir", "*.*", SearchOption.AllDirectories);//path is the path of the directory to get files from
//searchPattern is to get specific files. If you want only exe files you enter *.exe
private static IEnumerable<string> GetAllFiles(string path, string searchPattern)
{
return Directory.EnumerateFiles(path, searchPattern).Union(
Directory.EnumerateDirectories(path).SelectMany(d =>
{
try
{
return GetAllFiles(d, searchPattern);
} catch(Exception e)
{
return Enumerable.Empty<string>();
}
}));
}
Also in C#:
- start a particle effect when a button is pushed
- POST http://localhost:5001/api/v1/identity/login 500 (Internal Server Error) LoginForm.jsx:39 Error: Request failed with status code 500 at createError (createError.js:16) at settle (settle.js:17) at XMLHttpRequest.handleLoad (xhr.js:61)
- unity quaternion identity
- c sharp string interpolation
- c# aspx return image
- page parent wpf
- how can convert string to int csharp
- c# join array
- how to pass object as test case in nunit c#
- console.writeline
- c# convert dictionary to anonymous object
- variables
- whats a string
- c# write to console
- unity add component
- c# linq to get most recent item from IList
- add variable to the beginning of a list c#
- unity instantiate vector3
- can send but cannot receive email dreamhost email
- unity array of child objects
- c# expandoobject indexer
- get enum by index c#
- loops in coding
- c#if