diff --git a/snippets/csharp/VS_Snippets_VBCSharp/csFilesAndFolders/CS/FileIteration.cs b/snippets/csharp/VS_Snippets_VBCSharp/csFilesAndFolders/CS/FileIteration.cs index a2119a7bb7e..058bbc641de 100644 --- a/snippets/csharp/VS_Snippets_VBCSharp/csFilesAndFolders/CS/FileIteration.cs +++ b/snippets/csharp/VS_Snippets_VBCSharp/csFilesAndFolders/CS/FileIteration.cs @@ -442,12 +442,10 @@ static void Main() string destFile = System.IO.Path.Combine(targetPath, fileName); // To copy a folder's contents to a new location: - // Create a new target folder, if necessary. - if (!System.IO.Directory.Exists(targetPath)) - { - System.IO.Directory.CreateDirectory(targetPath); - } - + // Create a new target folder. + // If the directory already exists, this method does not create a new directory. + System.IO.Directory.CreateDirectory(targetPath); + // To copy a file to another location and // overwrite the destination file if it already exists. System.IO.File.Copy(sourceFile, destFile, true);