CopyDirectory

Copies a directory and its subdirectories

Member of namespace

FileIO

Syntax

bool CopyDirectory (string SourceDirectory, string DestDirectory, bool Recursive)

Parameters

SourceDirectory
Type: string
DestDirectory
Type: string
Recursive
Type: bool

Parameters

  • SourceDirectory : The path of the directory to copy.
  • DestDirectory : The path to the destination directory.
  • Recursive : True copies the directory files and subdirectories. False only copies the files in the initial directory.

Smart parameters are supported for the directory paths.

Returns

False if a failure occurs when copying a directory. If some of the files have been copied prior to the failure, those files remain. Otherwise, True.

Level

Any level.

Details

Copies the source directory to the target directory. If the target directory does not exist, it will be created, however the parent directory does need to exist.
Example
CopyDirectory("C:\MyDir1\MyDir2","C:\MyNewDir",True)   

This example copies MyDir2 and all files and subdirectories to C:\MyNewDir.