Visit Mozilla.org

XPInstall API Reference:File Object:Methods:move

From MDC

Contents

[edit] move

Moves a file from one location to another.

[edit] Method of

File object

[edit] Syntax

int move( FileSpecObject source, FileSpecObject dest );

[edit] Parameters

The move method has the following parameters:

source
A FileSpecObject representing the source file.
dest
A FileSpecObject representing the target directory.

[edit] Returns

An integer error code. For a list of possible values, see Return Codes.

[edit] Description

You must create a FileSpecObject for the destination directory to pass in for this function. If the destination doesn't already exist a file name for the destination is assumed.

[edit] Example

source = getFolder("Program", "file.txt");
dest = getFolder("Chrome");
err = File.move(source, dest);