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);
}
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);
}
Good post it's amazing the knowledge you have in your Niche
ReplyDeletemasterani