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); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)