I am using the below method to get the file names. But it returns the entire path and I don\'t want to get the entire path. I want only file names, not the entire path.
You could use the GetFileName method to extract only the filename without a path:
string filenameWithoutPath = Path.GetFileName(filename);