File Manipulations: Simple File Copy


I made some simple codes I did not get to use at work to copy one file from source to destination. It's a little crude around the edges and it needs a little more work.

Code Inspection

Check out the following codes:

string filename = "XXX.XML";
            StringBuilder srcPath = new StringBuilder(testContext.TestDeploymentDir);
            StringBuilder destPath = new StringBuilder(testContext.TestDeploymentDir); 
            if(!File.Exists(destPath.ToString() + "\\" + filename))
                srcPath.AppendFormat("\\{0}", filename);
                destPath.AppendFormat("\\{0}", filename);
                    File.Copy(srcPath.ToString(), destPath.ToString());
                catch (Exception ex)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License