Bitrix Site Manager

CopyDirFiles

bool
CopyDirFiles(
 string from,
 string to,
 bool rewrite = true,
 bool recursive = false,
 bool delete_after_copy = false,
 string exclude = ""
)

The function CopyDirFiles copies files and directories. Returns true on success, or false otherwise. 

Parameters

ParameterDescription
from Absolute path to a directory or file which is to be copied.
to Absolute path to the destination directory. The path specified in this parameter will be checked by the function CheckDirPath
rewrite Determines whether to overwrite the existing files.
Optional. True by default which means to overwrite.
recursive Specifies to recursively copy all subdirectories and files of the path specified in the parameter from.
Optional. False by default which means not to use recursion. 
delete_after_copy Specifies to delete the path passed in the parameter from after the copy (which in fact means moving directories and files).
Optional. False by default which means not to delete.
exclude If this parameter is not empty, files and folders having the name beginning with this parameter text are not to be copied.

See Also

Example



<?
// copy files from the folder /temp1/ to /temp2/
CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/temp1", 
             $_SERVER["DOCUMENT_ROOT"]."/temp2");
?>