I am new to C#. I am running an image gallery project and I want to get all .jpg files from the D:\ drive so I saw this code
string[] filePaths = Directory.GetFile(@"D:\", "*.jpg", SearchOption.AllDirectories);
But I get this error message of UnauthorizedAccessExeption Access to the path ... is denied.
Please is there a way I can search through all the sub folders of D:/ excluding the paths which dont have access permission. Because other users too wont have to edit the file permission