【发布时间】:2011-08-26 07:33:33
【问题描述】:
我想在 ASP.NET MVC 3 应用程序中从 server.MapPath 获取文件夹名称。
在此操作中,我必须检查(给定文件夹名称中是否存在更多文件夹)该文件夹中是否有 .jpg 文件,如果是,则返回该文件夹。
string path = Server.MapPath("Content/");
DirectoryInfo dInfo = new DirectoryInfo(path);
DirectoryInfo[] subdirs = dInfo.GetDirectories();
if (Directory.Exists(path))
{
ArrayList ar = new ArrayList();
// This path is a directory
ar.Add(path);
//ProcessDirectory(path);
}
【问题讨论】:
-
您好,感谢您的回复,我试图获取文件夹,但我没有得到解决方案,我已经在我的查询中发布了我的代码,请检查一次......并提供任何建议跨度>
标签: asp.net-mvc-3 c#-4.0 subdirectory