C# get only the files in directory code example
Example 1: c# get number of files in directory
int count = System.IO.Directory.EnumerateFiles(String path).Count();
Example 2: get directory of file c#
using System.IO;
string file = "C:\Documents\file.txt";
Path.GetDirectoryName(file);