CopyDirectory()

Syntax

Result = CopyDirectory(SourceDirectory$, DestinationDirectory$, Pattern$ [, Mode])
Description
Copy the contents of the source directory to the destination.

Parameters

SourceDirectory$ The directory to copy.
DestinationDirectory$ The destination to copy the directory to.
Pattern$ A pattern identifying the files to copy. For example: "*.*" will copy any files in the directory. "*.exe" will copy only the .exe files. By default, a null Pattern$ ("") will copy all the files.
Mode (optional) Options for the copy operation. It can be a combination of the following values:
  #PB_FileSystem_Recursive: Copy the directory with all subdirectories.
  #PB_FileSystem_Force    : Overwrites the files which are protected (read-only).

Return value

Returns nonzero if the operation was successful and zero if it failed.

Remarks

If the target directory already exists, its content will be overwritten automatically. The FileSize() function can be used to determine if the target exists or not.

Example

  Debug CopyDirectory("D:\Games\MyGame\", "D:\Games\Backup\", "", #PB_FileSystem_Recursive)

See Also

CreateDirectory(), ExamineDirectory(), DeleteDirectory()

Supported OS

All

<- CheckFilename() - FileSystem Index - CopyFile() ->