File.renameTo()

Availability

Flash Media Server 2.

Usage

fileObject.renameTo(name)

Parameters

name The new name for the file or directory. The name can contain only UTF-8 encoded characters; high byte values can be encoded using the URI character-encoding scheme. The specified name 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 will fail.

Returns

A Boolean value indicating whether the file was renamed or moved successfully (true) or not (false).

Description

Method; moves or renames a file. The operation fails if the file is open or the directory points to the root directory.

Example

The following code lets you execute code when myFileObject is renamed:

if (myFileObject.renameTo( "/logs/hello.log.old")){
    // Do something here.
}