从完整文件路径获取文件夹名称 [英] Get folder name from full file path

查看:102
本文介绍了从完整文件路径获取文件夹名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从应用程序的完整路径获取文件夹名称?

How do I get the folder name from the full path of the application?

这是下面的文件路径,

c:\projects\root\wsdlproj\devlop\beta2\text

这里的文本是文件夹名称。

Here "text" is the folder name.

如何从该路径中获取该文件夹名称?

How can I get that folder name from this path?

推荐答案

请参见 DirectoryInfo.Name

string dirName = new DirectoryInfo(@"c:\projects\roott\wsdlproj\devlop\beta2\text").Name;

这篇关于从完整文件路径获取文件夹名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆