资源简介
按指定层级遍历文件夹目录
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.xml;
namespace TraverseFolder
{
public partial class Form1 : Form
{
string savePath = null;
int flag = 0;
int flag2 = 0;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = “请选择文件路径“;
if (dialog.ShowDialog() == DialogResult.OK)
{
savePath = dialog.SelectedPath;
txtName.Text = savePath;
PaintTreeView(this.treeView1 savePath);
}
}
#region 生成程序所在根目录的TreeView
priva
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-09-10 14:02 TraverseFolder\
目录 0 2018-09-10 14:02 TraverseFolder\TraverseFolder\
目录 0 2018-12-10 15:24 TraverseFolder\TraverseFolder\TraverseFolder\
文件 187 2018-09-10 13:33 TraverseFolder\TraverseFolder\TraverseFolder\App.config
文件 5549 2018-12-10 09:22 TraverseFolder\TraverseFolder\TraverseFolder\Form1.Designer.cs
文件 7521 2018-12-10 15:24 TraverseFolder\TraverseFolder\TraverseFolder\Form1.cs
文件 6015 2018-12-10 14:13 TraverseFolder\TraverseFolder\TraverseFolder\Form1.resx
文件 526 2018-09-10 09:37 TraverseFolder\TraverseFolder\TraverseFolder\Program.cs
目录 0 2019-04-12 08:28 TraverseFolder\TraverseFolder\TraverseFolder\Properties\
文件 1370 2018-09-10 09:37 TraverseFolder\TraverseFolder\TraverseFolder\Properties\AssemblyInfo.cs
文件 2880 2018-09-10 09:37 TraverseFolder\TraverseFolder\TraverseFolder\Properties\Resources.Designer.cs
文件 5612 2018-09-10 09:37 TraverseFolder\TraverseFolder\TraverseFolder\Properties\Resources.resx
文件 1101 2018-09-10 09:37 TraverseFolder\TraverseFolder\TraverseFolder\Properties\Settings.Designer.cs
文件 249 2018-09-10 09:37 TraverseFolder\TraverseFolder\TraverseFolder\Properties\Settings.settings
文件 257 2019-04-12 08:28 TraverseFolder\TraverseFolder\TraverseFolder\Properties\licenses.licx
文件 4642 2018-09-10 09:51 TraverseFolder\TraverseFolder\TraverseFolder\TraverseFolder.csproj
目录 0 2018-09-10 14:02 TraverseFolder\TraverseFolder\TraverseFolder\bin\
目录 0 2018-09-10 14:02 TraverseFolder\TraverseFolder\TraverseFolder\bin\Debug\
文件 12800 2019-04-12 08:28 TraverseFolder\TraverseFolder\TraverseFolder\bin\Debug\TraverseFolder.exe
文件 187 2018-09-10 13:33 TraverseFolder\TraverseFolder\TraverseFolder\bin\Debug\TraverseFolder.exe.config
文件 30208 2019-04-12 08:28 TraverseFolder\TraverseFolder\TraverseFolder\bin\Debug\TraverseFolder.pdb
文件 24224 2019-04-12 08:29 TraverseFolder\TraverseFolder\TraverseFolder\bin\Debug\TraverseFolder.vshost.exe
文件 187 2018-09-10 13:33 TraverseFolder\TraverseFolder\TraverseFolder\bin\Debug\TraverseFolder.vshost.exe.config
文件 490 2013-03-18 17:00 TraverseFolder\TraverseFolder\TraverseFolder\bin\Debug\TraverseFolder.vshost.exe.manifest
目录 0 2018-09-10 14:02 TraverseFolder\TraverseFolder\TraverseFolder\obj\
目录 0 2019-04-12 08:28 TraverseFolder\TraverseFolder\TraverseFolder\obj\Debug\
文件 77477 2018-09-10 09:46 TraverseFolder\TraverseFolder\TraverseFolder\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7777 2018-09-10 14:21 TraverseFolder\TraverseFolder\TraverseFolder\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
目录 0 2020-06-17 09:01 TraverseFolder\TraverseFolder\TraverseFolder\obj\Debug\TempPE\
文件 0 2018-09-10 09:37 TraverseFolder\TraverseFolder\TraverseFolder\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2018-09-10 09:37 TraverseFolder\TraverseFolder\TraverseFolder\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
............此处省略11个文件信息
相关资源
- C# 快捷查看文件夹下所有文件的MD5
- C# 获取和设置文件夹属性(创建修改
- 伪装文件夹
- C# 用递归的方式查找指定文件夹下的
- 根据记事本中的文件夹名,复制指定
- C# 加载文件夹下的所有图片并显示其
- c#源代码 遍历指定路径并写入excel文件
- C#解压缩文件夹保存目录结构
- 监视文件和文件夹系统变化情况,C
- wpf 扫描文件夹下面所有图片 并加载
- WPF文件夹的创建和删除
- C# 动态搜索文件或文件夹
- C#伪装文件夹 ,可以起到隐藏文件夹
- C# 遍历所有 窗体句柄 源码
- c#爬虫:爬网页图片直接到桌面文件夹
- C#编写的小浏览器,文件夹图片批量缩
- 浏览图像,点击按钮将文件分类到文
- C# 仿资源管理器(浏览本地文件以及
- C# 监视文件和文件夹系统变化情况
- C# 检索文件目录下所有文件,加载至
- 文件夹选择之FolderBrowserDialog控件
- C# 获取指定目录下(含子文件夹)指
- 源码:基于文件夹目录生成CHM电子书
- Net Share方法创建Everyone权限共享文件夹
- C# 解压缩文件和文件夹源码
- C# 获取文件列表以及遍历文件夹
- C# 定期删除指定文件夹下的文件
- 遍历文件夹、文件批量提取txt 文件中
- 按照文件夹显示文件并进行文件复制
- winform 文件夹浏览器
评论
共有 条评论