CopyDirectory()

Syntax

Result = CopyDirectory(SourceDirectory$, DestinationDirectory$, Pattern$ [, Mode])
Description
Copy the contents of the source directory to the destination. Warning, if the directory already exists, it will be overwritten automatically. If the Result is 0, the directory can't be copied.

The 'Pattern$' should be a valid OS pattern. 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' is optional and 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 (ReadOnly).
Example:
  Debug CopyDirectory("D:\Games\MyGame\", "D:\Games\Backup\", "", #PB_FileSystem_Recursive)

Supported OS

All

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