How to get only filenames within a directory using c#?
string files = Directory.GetFiles(dir);
You can use
System.IO.Path.GetFileName to do this.
string files = Directory.GetFiles(dir); foreach(string file in files) Console.WriteLine(Path.GetFileName(file));
While you could use
FileInfo, it is much more heavyweight than the approach you are already using (just retrieving file paths). So I would suggest you stick with
GetFiles unless you need the additional functionality of the