Get filenames without path of a specific directory

前端 未结 8 1076
半阙折子戏
半阙折子戏 2020-12-13 16:44

How can I get all filenames of a directory (and its subdirectorys) without the full path? Directory.GetFiles(...) returns always the full path!

8条回答
  •  天命终不由人
    2020-12-13 17:31

    You can just extract the file name from the full path.

    var sections = fullPath.Split('\\');
    var fileName = sections[sections.Length - 1];
    

提交回复
热议问题