move Function

Top  Previous  Next

Renames a file or folder, or moves a file or folder between folders.

Syntax

File.move(srcPath, srcFolder, dstPath [, dstFolder])

Arguments

srcPathA string with the path to the file or folder.
srcFolderAn instance of a File object representing a folder which srcPath is relative to, or null if srcPath is from the root.
dstPathA string with the new path to the file or folder.
dstFolderAn optional instance of a File object representing a folder which dstPath is relative to. If omitted, srcFolder is used.

Return Value

Zero if successful; a negative number representing an error code if failure.

Remarks

If the combination of srcFolder and srcPath are in the same folder as the combination of dstFolder and dstPath, then this function renames the file or folder in that folder. Otherwise, the file or folder is moved to a new folder.

 

The file or folder being moved or renamed must not be open.

Examples

 

See Also