How can I access a mapped network drive with System.IO.DirectoryInfo?

后端 未结 7 1730
无人及你
无人及你 2020-12-28 13:03

I need to create a directory on a mapped network drive. I am using a code:

DirectoryInfo targetDirectory = new DirectoryInfo(path);
if (targetDirectory != nu         


        
7条回答
  •  Happy的楠姐
    2020-12-28 13:38

    Based on the fact, mapped drive letters don't work, the simple solution is to type the full network path.

    Aka,

    my R:/ drive was mapped to \\myserver\files\myapp\

    So instead of using

    "R:/" + "photos"

    use

    "\\myserver\files\myapp\" + "photos"

提交回复
热议问题