[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'FileUtil' (#lazutils)

CopyDirTree

Copies all file system entries in a source directory to the destination directory using the specified options.

Declaration

Source position: fileutil.pas line 204

function CopyDirTree(

  const SourceDir: string;

  const TargetDir: string;

  Flags: TCopyFileFlags = []

):Boolean;

Arguments

SourceDir

  

Directory with the files copied in the routine.

TargetDir

  

Directory where the copied files are stored.

Flags

  

Options enabled for the copy operation; default value is an empty set ([])

Function result

True when all files are successfully copied in the routine.

Description

CopyDirTree is a Boolean function used to copy file system entries from the directory in SourceDir to the directory in TargetDir.

Values in SourceDir and TargetDir are fully-qualified path names for the directories. If a trailing path delimiter is omitted in SourceDir or TargetDir, it is appended (when needed) to the values. TargetDir cannot be a sub-directory located in SourceDir. No actions are performed in the routine when TargetDir is located within the specified SourceDir.

Flags contains values representing the options enabled in the copy operation. The default value for the parameters is an empty set ([]) and indicates that none of the TCopyFileFlag options are enabled. The value cffCreateDestDirectory is always added to the values in Flags internally; CopyDirTree requires the destination directory to be created if it does not already exist.

See TCopyFileFlag for more information about the option values and their meanings.

The return value is True when all file system entries in SourceDir are successfully copied in the routine. Please note that a portion of the copy operation may have been performed successfully even when the return value is False.

Use CopyFile to copy a single file with a given name to a new file name.

See also

CopyFile

  

Copies the source file to the destination file using the specified options.

TCopyFileFlags

  

Set type used to store TCopyFileFlag enumeration values.


Version 3.2 Generated 2024-02-25 Home