Hi sir,
Tell me the steps to move the file from one system to another system over a network using asp.net c#. I developed using asp.net c# windows application, its working fine in local file transfer from localdisk C: drive to d: drive. But if i put ipaddress like "\\192.168.10.37\c$\prabu1", it will not move the file to that destination [192.168.10.37]. I attached the code for your reference. Give me a valuable feedback with the proper solution.
Code:
**************
private void Form1_Load(object sender, EventArgs e)
{
string source_directory = @"c:\datas";
string destination_directory = @"\\192.168.10.37\d$\prabu1";
DirectoryInfo sourceinfo = new DirectoryInfo(source_directory);
DirectoryInfo destinationinfo = new DirectoryInfo(destination_directory);
if (sourceinfo.Exists)
{
string s1 = sourceinfo.FullName;
string d1 = destinationinfo.FullName;
if (Directory.GetFiles(s1).Length > 0 && Directory.GetDirectories(s1).Length == 0)
{
if (destinationinfo.Exists)
{
string s = sourceinfo.FullName;
foreach (var filenames in Directory.GetFiles(s1))
{
//File.Move(str, Path.Combine(dir, Path.GetFileName(str)));
string source_location = filenames;
string prabu = Path.GetFileName(source_location);
string myFile = source_location;
string fileToCopy = destination_directory+"\\"+prabu;
if (File.Exists(fileToCopy))
{
File.Delete(fileToCopy);
}
File.Move(myFile, fileToCopy);
}
}
}
}
else
{
//this.Close();
notifyIcon1.BalloonTipText = "No such directory exists in that location";
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(300, "Notify Icon", "No such directory exists in that location", ToolTipIcon.Error);
//MessageBox.Show("No such directory exists in that location", "Folder not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
With regards,
J.Prabu.
[Email:prbspark@gmail.com]