C#访问局域网内共享文件夹

    //远程服务器IP地址
        string remoteServerIP = @"\\192.168.3.104";
        //共享文件夹D:\\data 注意表示D盘,D$要大写
        string remoteServerCatalog = @"\\192.168.3.104\D$\data\";
        //连接到共享目录
        DirectoryInfo di = new DirectoryInfo(remoteServerCatalog);
        StringBuilder sb = new StringBuilder();
        foreach (DirectoryInfo subDir in di.GetDirectories())
        {
            sb.Append(subDir.Name + "\n\r");
        }
        Console.WriteLine(sb.ToString());
    原文作者:浪子君
    原文地址: https://blog.csdn.net/weixin_38703076/article/details/94723148
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞