惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
InfoQ
C
CERT Recently Published Vulnerability Notes
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
GbyAI
GbyAI
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
P
Privacy & Cybersecurity Law Blog
Simon Willison's Weblog
Simon Willison's Weblog
Jina AI
Jina AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
博客园_首页
F
Fortinet All Blogs
博客园 - Franky
Latest news
Latest news
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
D
Docker
Project Zero
Project Zero
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
Cisco Talos Blog
Cisco Talos Blog
Y
Y Combinator Blog
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
H
Help Net Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
PCI Perspectives
PCI Perspectives
Cloudbric
Cloudbric
V
Visual Studio Blog
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理

博客园 - 猫狼

安卓连接usb camera 安卓手机连接USB摄像头代码 安装Memurai 把“休眠”功能找回来,并设置成一合上盖子就生效 mathtype安装后在office无法启动,提示运行时错误53, 文件未找到:MathPage.WLL ASP.NET Web Site Project 中集成 Hangfire 并实现图片/视频压缩后台任务 SQL SERVER 数据库压缩日志步骤 Latex的一个错误, SQL 学习笔记 升级 ASP.NET 网站项目到 C# 6.0 或更高版本 C#程序集合并工具-ILRepack manim 安装 manim一个坑爸爸的问题 manim安装纪实 去掉快捷方式的小箭头 VS2022转到定义功能异常解决方案 url 传递加号,asp.net解析参数的正确处理参数 获取自然周数的下拉列表 移出Json对象的三级属性 梦记:又要去交流? 一段VBA的代码,到处是坑 多个AJAX请求,带执行进度及结果 解决JS跨域访问的问题 利用Jquery的map函数将json数据行转化为表格 模访京东商城jQuery省市区三级联动选择(横向DIV)
C# 返回文件夹及子目录
猫狼 · 2024-07-15 · via 博客园 - 猫狼
     /// <summary>
     /// 返回文件夹及子目录的文件夹
     /// </summary>
     /// <param name="directory"></param>
     /// <param name="files"></param>
     public static void GetFiles(string directory, ref Dictionary<string, FileInfo> files)
     {
         DirectoryInfo di = new DirectoryInfo(directory);
         if (di.Exists)
         {
             foreach (FileInfo f in di.GetFiles())
             {
                 if (files.ContainsKey(f.FullName)) continue;
                 files.Add(f.FullName, f);
             }

             foreach (DirectoryInfo d in di.GetDirectories())
             {
                 GetFiles(d.FullName, ref files);
             }
         }
     }

     /// <summary>
     /// 返回指定类型的文
     /// </summary>
     /// <param name="directory"></param>
     /// <param name="extension"></param>
     /// <param name="files"></param>
     public static void GetFiles(string directory, string extension, ref Dictionary<string, FileInfo> files)
     {
         DirectoryInfo di = new DirectoryInfo(directory);
         if (di.Exists)
         {
             foreach (FileInfo f in di.GetFiles($"*{extension}"))
             {
                 if (files.ContainsKey(f.FullName)) continue;
                 files.Add(f.FullName, f);
             }

             foreach (DirectoryInfo d in di.GetDirectories())
             {
                 GetFiles(d.FullName, extension, ref files);
             }
         }
     }
//调用方式        
Dictionary<string,FileInfo> files = new Dictionary<string,FileInfo>(); GetFiles(AppContext.BaseDirectory,".jpg", ref files);