A union of curiosity and data science

Knowledgebase and brain dump of a database engineer

C# Get file names in directory (loop through directory and get filenames)

Gather a set of filenames from a directory and it's sub folders. 

      string[] files =
                Directory.GetFiles("D:\\M2Images", "*.jpg", SearchOption.AllDirectories);


This returns an array of absolute paths to all of the files in the directory specified in the first argument of GetFiles. 

Add comment