具有正则表达式的FolderExists [英] FolderExists with regular expression

查看:72
本文介绍了具有正则表达式的FolderExists的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我在该路径中有一个带正则表达式的文件夹路径.我想检查该文件夹是否存在.我该如何移动呢?

例如:

hi all,
i''ve a folder path with regular expression in that path.i want to check whether that folder is in existance.how can i move with this?

eg:

Dim folder
folder="C:\*folder* 'path with regularexpression"
if(filesystem.FolderExists(folder))
filesystem.DeleteFolder(folder)



在此先谢谢您



Thank you in advance

推荐答案



像这样尝试,

Hi,

Try like this,

var dirs = from dir in 
           Directory.EnumerateDirectories(dirPath, "C:\\*folder*",
           SearchOption.AllDirectories)
           select dir;



它将返回与模式匹配的文件夹.



it will return you the folders that matches the pattern.


这篇关于具有正则表达式的FolderExists的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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