c# code
c# code to get files from one folder to another folder on button click?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Feb 25, 2013, 11:14 AM
private button1_Click(object sender, EventArgs e)
{
string sourceFolder = @"c:\whatever";
string destinationFolder = @"c:\whatever2";
foreach(string sourcePath in Directory.GetFiles(sourceFolder))
{
string destinationPath = destinationFolder + "\\" + Path.GetFileName(sourcePath);
if(!File.Exists(destinationPath)) File.Move(sourcePath, destinationPath);
}
}
Manjunatha SrinivasappaPosted Feb 26, 2013, 12:54 AM