Copies directories using either top level only or deep merge copy.

Copies a directory by copying files from source folder to target folder. If folder(s) don't exist they are created.

deepCopy copies files in sub-folders and merges them into the target folder. Unless you specify deleteFirst, files are copied and overwrite or add to existing structure, leaving old files in place. Use deleteFirst if you want a new structure with only the source files.

public static void CopyDirectory(string sourcePath,
	string targetPath,
	bool deleteFirst,
	bool deepCopy)


Path to copy from

Path to copy to

If true deletes target folder before copying. Otherwise files are merged from source into target.


See also:

Class FileUtils

© West Wind Technologies, 2019 • Updated: 06/23/19
Comment or report problem with topic