开发者

Copying information from a server

开发者 https://www.devze.com 2023-03-15 00:44 出处:网络
We have a se开发者_开发百科rver with a folder of local users on the C: drive. How would i go about copying the folder from that server to my local machine. Any help at all will be appreciated. i haven

We have a se开发者_开发百科rver with a folder of local users on the C: drive. How would i go about copying the folder from that server to my local machine. Any help at all will be appreciated. i haven"t done this kind of programming before so i have no idea where to start

Thanks


If the machine the program is running on has access to that share, it's exactly the same as copying from your local folder except changing the path.

So let's for argument's sake say you want to copy from \Server\Users (where Server is the servername, users is the share name) to your local c:\userShare folder, then it's as simple as:

File.Copy(@"\\Server\Users",@"c:\userShare");

You will obviously still need to implement the logic in terms of getting all the files in the directory etc, see here for an example.

If you need to give access to the machine first, have a look here for more info.


Use a UNC path (\\server\volume\directory\file) to server location, and use File.Copy Method

How to: Copy, Delete, and Move Files and Folders (C# Programming Guide)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号