如何在C#的父目录中过滤子文件夹和文件? [英] How to filter sub folders and files with in the same in a parent directory in C#?

查看:209
本文介绍了如何在C#的父目录中过滤子文件夹和文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中的父目录中过滤子文件夹和文件?



我正在进行文件存档我在哪里移动文件目标目录。会有多个子文件夹。我想过滤那些与父目录中所需相同的子文件夹和文件,而不是遍历所有子文件夹。



什么我试过了:



string [] folders = Directory.GetDirectories(sourceFolder);



//从源文件夹中获取文件(如果有的话)

string [] files = Directory.GetFiles(sourceFolder);

解决方案

有一个看看



[ ^ ]

How to filter sub folders and files with in the same in a parent directory in c#?

I am doing File Archival where I am moving files with in the destination directory.There would be multiple sub folders that would be there. I want to filter only those sub folders and files with in the same as required with in the parent directory instead of going through all the sub folders.

What I have tried:

string[] folders = Directory.GetDirectories(sourceFolder);

//Fetching files from source folder if any
string[] files = Directory.GetFiles(sourceFolder);

解决方案

have a look

[^]


这篇关于如何在C#的父目录中过滤子文件夹和文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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