MOVEFILE Function

Moves or renames a specified file.

Category: External File
Returned data type: Integer
Note: The returned value is a Boolean value where 1= success and 0 = error.

Syntax

movefile(<old_file, new_file_name>)

Required Arguments

old_file_name

a string representing the name of the file to be moved; this can be specified as a fixed string, field name, or expression

new_file_name

a string representing the name (including location) where the file will be moved; this can be specified as a fixed string, field name, or expression

Details

The movefile function moves a file. The directory structure must already be in place for the function to move the file to its new location. If the target file already exists, the file will not be moved and false will be returned.

Example

string old_file_name

string new_file_name

boolean rc_ok

 

old_file_name = "C:\mydata_copy.txt"

new_file_name = "C:\TEMP\mydata_copy.txt"

 

rc_ok = movefile(old_file_name, new_file_name)