如何组合路径但忽略c#中的某些文件夹? [英] how to combine path but ignore some folder in c#?

查看:54
本文介绍了如何组合路径但忽略c#中的某些文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有文件夹路径是:



string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),@\ Mozilla \ Firefox \Profiles\db3px41f.default\places.sqlite);



但如何忽略db3px41f.default文件夹.how to .. .. div class =h2_lin>解决方案

因此,如果您不希望默认配置文件文件夹只使用Profiles文件夹的路径:

  string  path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @  \ Mozilla \ Firefox \Profiles); 





然后你可以搜索子目录使用:

 Directory.GetDirectories(path); 


i have folder path is :

string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"\Mozilla\Firefox\Profiles\db3px41f.default\places.sqlite");

but how to ignore db3px41f.default folder .how to do ..

解决方案

So if you don't want your default profile folder just use path to Profiles folder:

string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"\Mozilla\Firefox\Profiles");



Then you can search for subdirectories using:

Directory.GetDirectories(path);


这篇关于如何组合路径但忽略c#中的某些文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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