检查c#中路径中是否存在文件夹? [英] Check whether a folder exists in a path in c#?
本文介绍了检查c#中路径中是否存在文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查目录中是否存在名为 RM
的文件夹...我已经通过文本框给出目录路径,如 txtBoxInput.Text
在这个路径我必须检查...任何建议?
How to check whether a folder named RM
exists inside a directory...I have given the directory path through textbox like txtBoxInput.Text
and in this path i have to check...Any suggestion?
推荐答案
Path.Combine和Directory 。出现?
Path.Combine and Directory.Exists ?
http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx
< a href =http://msdn.microsoft.com/en-us/library/system.io.directory.exists.aspx =noreferrer> http://msdn.microsoft.com/en-us/ library / system.io.directory.exists.aspx
if (Directory.Exists(Path.Combine(txtBoxInput.Text, "RM"))
{
// Do Stuff
}
这篇关于检查c#中路径中是否存在文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文