Ignore folders/files when Directory.GetFiles() is denied access

前端 未结 8 1838
余生分开走
余生分开走 2020-11-22 04:27

I am trying to display a list of all files found in the selected directory (and optionally any subdirectories). The problem I am having is that when the GetFiles() method co

8条回答
  •  一向
    一向 (楼主)
    2020-11-22 04:47

    see https://stackoverflow.com/a/10728792/89584 for a solution that handles the UnauthorisedAccessException problem.

    All the solutions above will miss files and/or directories if any calls to GetFiles() or GetDirectories() are on folders with a mix of permissions.

提交回复
热议问题