This is the documentation for the development version. There are no official binaries for it; build it from the source code in git. Download links on these pages work only after the release. For the current release, see version 7.0.

IO::CopyFile

IO::CopyFile(sourceFileName, destinationFileName): bool

Makes a copy of source file or folder to destination file or folder and returns TRUE if action was successful.

In server scripts, IO:: functions are available only if server configuration variable NXSL.EnableFileIOFunctions is enabled (change requires server restart). They are always available in scripts run by nxscript.

In addition, a script that runs on behalf of a user (see Scripts Started by a User) needs the "Access server file system from scripts" system access right, and scripts in read-only script contexts cannot use IO:: functions while Scripts.RestrictWriteAccess is enabled. A denied call returns false without a script error.

Table 1. Parameters

sourceFileName

String

Source file/folder name

destinationFileName

String

Destination file/folder name

Return

TRUE if copy was successful and FALSE if not.

IO::CopyFile("/tmp/source", "/tmp/destination") // Will copy "/tmp/source" file content to "/tmp/destination" file.