For smart Primates & ROBOTS (oh and ALIENS ).

Saturday, July 05, 2014

Send Files to IP address in C#

If there are you situation you want to send file to IP address,
then use listed below code:

string sourceDir = @"C:\\tt";
string destIP = @"\\10.10.10.10\shared-folder-amit";
string[] sourceFiles = Directory.GetFiles(sourceDir, "*", SearchOption.AllDirectories);
foreach (string files in sourceFiles) {
  string localFile = files.Replace(sourceDir, "");
  if (!Directory.Exists(Path.GetDirectoryName(destIP + "\\" + localFile)))
    Directory.CreateDirectory(Path.GetDirectoryName(destIP + "\\" + localFile));
  File.Copy(files, destIP + "\\" + localFile, true);
}



Share:

Related Posts:

1 comment:

  1. Good post it's amazing the knowledge you have in your Niche
    masterani

    ReplyDelete

Ads Inside Post

Powered by Blogger.

Archive