Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
9
Reply
copy the contents of one folder to other
yashu v
Apr 12 2016 5:39 AM
354
Reply
how can i copy the contents of one folder to other, and other as create a folder like this format
AutomatedBuild_12_04_2016_14_30
string sourcePath = @"D:\StarTeam\CMP\Coding\AutomatedBuild";
string targetPath = @"D:\StarTeam\CMP\Coding\AutoBuildArtifacts\AutomatedBuildBackups";
if (!Directory.Exists(targetPath))
{
Directory.CreateDirectory(AutomatedBuild.DateNow());
}
foreach (var srcPath in Directory.GetFiles(sourcePath))
{
//Copy the file from sourcepath and place into mentioned target
path,
//Overwrite the file if same file is exist in target path
File.Copy(srcPath, srcPath.Replace(sourcePath, targetPath),
true);
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
9
)
Next Recommended Forum
genrate the multiple pdf all employee rdlc report
How to bind the data to gridview control in MVC 2