string MoveFile(string, string)

Moves a file or directory from one location on the filesystem to another.

Security

Trust Level Required: Full Trust

Parameters

Name Description
srcPath string
The path of the file or directory to move.
destPath string
The destination path to move the file or directory to.

Return

A JSON string where Bool indicates if the function succeeded and Str is an error message on failure.

Remarks

Both the source location and destination location must be fully qualified paths, including the name of the target file or directory name. Failing to specify the target name will result in overwriting the target instead of placing the file or directory inside of it.

Examples


// rename file.txt to file2.txt, and move it up a directory
var strresult = KioFileIO.MoveFile('/sdcard/path/to/move/file.txt', '/sdcard/path/to/file2.txt');
var objresult = JSON.parse(strresult);
if (!objresult.Bool) {
    alert('Error moving file: ' + objresult.Str); 
} else {
    alert('Move succeeded!');
}
    

Requirements

KioWare for Android version 3.16 or greater.