如何在C#的父目录中过滤子文件夹和文件? [英] How to filter sub folders and files with in the same in a parent directory in 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屋!