Script functions reference > Script functions in alphabetical order > F > FileMove

FileMove
Syntax
FileMove(sourcefile, dest_file);
sourcefile
dest_file
Description
Moves the specified file from one location to another (the original file is deleted). See also IoErrText.
Returns
A number indicating whether the file was successfully moved.
0
The file was successfully moved, or the file does not exist. To avoid situations where 0 is returned for non-existing files, you can include the Exist() script function first to check that the file exists
>0
Failure. This value can be sent to IoErrText which will return an error text for the failure.
Example
//Move the contents of myfile.txt to mynewfile.txt 
//and store the returned value in $err
 
$err = filemove("myfile.txt","mynewfile.txt");
 
//If the action was unsuccessful, pass the error value
//to ioerrtext and store the error text returned by
//ioerrtext in $errtext.
//Send the error text to the log file
 
if(num($err)!=0)
{
$errtext=ioerrtext($err);
log(0,"Errortext "+$errtext);
}
OpenText StreamServe 5.6 Updated: 2013-03-01