Click or drag to resize

DiskUtilitiesTryCopyDirectory Method (DirectoryInfo, DirectoryInfo, Boolean, String)

Attempts to copy all the files in a directory from one place to another.

Namespace:  DustProductions.Core
Assembly:  DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static bool TryCopyDirectory(
	DirectoryInfo sourceInfo,
	DirectoryInfo targetInfo,
	bool alsoCopySubfolders = true,
	string[] excludedFileExtensions = null
)

Parameters

sourceInfo
Type: System.IODirectoryInfo
A DirectoryInfo for the directory you want to copy
targetInfo
Type: System.IODirectoryInfo
A DirectoryInfo for the directory you want the files to be in after copying (the directory will be created if it doesn't exist)
alsoCopySubfolders (Optional)
Type: SystemBoolean
Optional parameter to indicate whther or not you want to recursively move all subdirectories. Defaults true.
excludedFileExtensions (Optional)
Type: SystemString
Optional parameter to pass in file extensions that won't be copied. Defaults null.

Return Value

Type: Boolean
True if the copy completes without raising an exception and the source directory exists at the path specified
See Also