Hi,
Please refer below code
C#
string fileName = "Watermark.png";
string sourcePath = @"D:\";
string targetPath = @"d$\newfolder\images";
string[] ips = new string[] { "192.192.11.20", "192.192.11.21", "192.192.11.22" };
foreach (string ip in ips)
{
// Use Path class to manipulate file and directory paths.
string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
string destFile = System.IO.Path.Combine(targetPath, fileName);
destFile = string.Format("\\\\{0}\\{1}", ip, destFile);
// To copy a folder's contents to a new location:
// Create a new target folder, if necessary.
if (!System.IO.Directory.Exists(targetPath))
{
System.IO.Directory.CreateDirectory(targetPath);
}
// To copy a file to another location and
// overwrite the destination file if it already exists.
System.IO.File.Copy(sourceFile, destFile, true);
}
I hope this will help you out.