Is there a way of recover from an Exception in Directory.EnumerateFiles?

前端 未结 4 1182
攒了一身酷
攒了一身酷 2020-12-19 12:16

In .NET 4, there\'s this Directory.EnumerateFiles() method with recursion that seems handy.
However, if an Exception occurs within a recursion, how can I continue/recove

4条回答
  •  情话喂你
    2020-12-19 12:18

    I had the same problem and re-implemented the functionality. You can find the solution at http://rwtools.codeplex.com/.

    Inside are classes like "DirectoryEnumerator" and "FileEnumerator" which ignores errors, or (if sombody likes) throws the error and continue iterating.

    Hope it helps.

    Regards, Sandro

提交回复
热议问题