private void button1_Click(object sender, EventArgs e) { //File path where you need to copy string configFilePath = @"C:\Windows\Files\"; try { if (!Directory.Exists(configFilePath)) { Directory.CreateDirectory(configFilePath); } //File path where you are stored in the solution itself string SourceFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Files\"); string[] sourceFiles = Directory.GetFiles(SourceFilePath); foreach (var file in sourceFiles) { File.Copy(file, configFilePath + Path.GetFileName(file), true); } } catch (Exception) { }
catch
try ... catch
AppDomain.CurrentDomain.BaseDirectory
SourceFilePath
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)