File.copyTo()

Availability

Flash Media Server 2.

Usage

fileObject.copyTo(name)

Parameters

name Specifies the name of the destination file. The name can contain only UTF-8 characters; high byte values can be encoded using the URI character-encoding scheme. The name specified is mapped to a system path using the mappings specified in the Application.xml file. If the path is invalid or the destination file doesn't exist, the operation fails, and the method returns false.

Returns

A Boolean value indicating whether the file as copied successfully (true) or not (false).

Description

Method; copies a file to a different location or copies it to the same location with a different file name. The method returns false if the source file doesn't exist or if the source file is a directory.

Example

The following code copies the file set by myFileObj file object to the location provided by the parameter:

if (myFileObj.copyTo( "/logs/backup/hello.log")){
    // Do something here.
}