Possible duplicate:
How to get only file names in a directory using C #?
Using C #, I want to get a list of files in a folder.
My goal: ["file1.txt", "file2.txt"]
So I wrote this:
string[] files = Directory.GetFiles(dir);
Unfortunately, I get this output: ["C:\\dir\\file1.txt", "C:\\dir\\file2.txt"]
After that, I could remove the unnecessary part of "C: \ dir \", but is there a more elegant solution?
c # filepath
Nicolas Raoul Sep 21 '12 at 4:45 2012-09-21 04:45
source share