Get the (last part of) current directory name in C#

后端 未结 10 618
灰色年华
灰色年华 2020-12-08 08:48

I need to get the last part of current directory, for example from /Users/smcho/filegen_from_directory/AIRPassthrough, I need to get AIRPassthrough

10条回答
  •  误落风尘
    2020-12-08 09:20

    You could try:

    var path = @"/Users/smcho/filegen_from_directory/AIRPassthrough/";
    var dirName = new DirectoryInfo(path).Name;
    

提交回复
热议问题