Recursive File Search in .net

后端 未结 3 524
醉酒成梦
醉酒成梦 2020-12-08 15:57

I need to search a drive (C:, D: etc) for a partuicular file type (extension like .xml, .csv, .xls). How do I preform a recursive search to loop all directories and inner di

3条回答
  •  余生分开走
    2020-12-08 16:25

    It looks like the recls library - stands for recursive ls - now has a pure .NET implementation. I just read about it in Dr Dobb's.

    Would be used as:

    using Recls;
    using System;
    static class Program { // formatted for vertical space
        static void Main() {
            foreach(IEntry e in FileSearcher.Search(@"c:\", "*.xml|*.csv|*.xls")) {
                Console.WriteLine(e.Path);
            }
        }
    

提交回复
热议问题