如何从给定路径 Server.MapPath 获取子文件夹名称
我想从 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);
}
I want get the folder names from server.MapPath
in ASP.NET MVC 3 application.
In this action, I have to check (if there exist more folders in a given folder name) if a .jpg file is in that folder and if so, return that folder.
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);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否正确理解了这个问题,但我认为你想要类似
的东西
I'm not sure I've understand the qestion correctly, but I think you want something like
or something like