Skip to content

Commit 5c00824

Browse files
shadialnamroutiBillWagner
authored andcommitted
Update FileIteration.cs (#861)
1 parent 257ee91 commit 5c00824

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

snippets/csharp/VS_Snippets_VBCSharp/csFilesAndFolders/CS/FileIteration.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,10 @@ static void Main()
442442
string destFile = System.IO.Path.Combine(targetPath, fileName);
443443

444444
// To copy a folder's contents to a new location:
445-
// Create a new target folder, if necessary.
446-
if (!System.IO.Directory.Exists(targetPath))
447-
{
448-
System.IO.Directory.CreateDirectory(targetPath);
449-
}
450-
445+
// Create a new target folder.
446+
// If the directory already exists, this method does not create a new directory.
447+
System.IO.Directory.CreateDirectory(targetPath);
448+
451449
// To copy a file to another location and
452450
// overwrite the destination file if it already exists.
453451
System.IO.File.Copy(sourceFile, destFile, true);

0 commit comments

Comments
 (0)