string sourcepath = @"c:\current"; string path = @"c:\path"; if (!System.IO.Directory.Exists(path)) // check if folder exist { System.IO.Directory.CreateDirectory(path); string[] files = System.IO.Directory.GetFiles(sourcepath); foreach (string f in files) { // Remove path from the file name. string fName = f.Substring(sourcepath.Length + 1); // Use the Path.Combine method to safely append the file name to the path. // Will overwrite if the destination file already exists. File.Copy(Path.Combine(sourcepath, fName), Path.Combine(path, fName), true); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)