Description:
Move, delete, or rename a file.
Syntax:
movefile(fn:z,path)
Note:
The function moves file fn to a file specified by parameter path. Delete file fn if path is absent; rename the file if only the file name is specified in the path.
Parameter:
fn |
File name. |
z |
An integer; it represents the zone table number when parameter fn is a homo-name files group; or is omitted when fn isn’t a homo-name files group. |
path |
The path (with file name) along which the file is moved, or a file name. |
Option:
@y |
Force an execution of the function if the target file already exists. Without the option you can’t force an execution. Delete the target file if parameter path is absent. |
@c |
Copy the file. If the target file name is the same as that of the specified file to which it will be moved, the copy fails. |
@p |
path is relative to the main directory when it is a relative path; default is relative to fn’s parent directory. |
Return value:
Boolean value
Example:
|
A |
|
1 |
=movefile("E://test.property","D://testfile.property") |
Move the file to testfile.property file under root directory on driver D. |
2 |
=movefile("D://testfile.property","file.property") |
D://testfile.property is renamed file.property. |
3 |
=movefile("D://file.property") |
Delete file.property. |
4 |
=movefile@y("E://test1.property","D://testfile1.property") |
The file testfile1.property already exists. Force the move and override the original file. |
5 |
=movefile@c("D://testfile1.property","file.property") |
Copy the file, instead of renaming it |
6 |
=movefile@cy("E://test2.property","D:// file.property") |
file.property already exists. Force the copy and override the original file. |
7 |
=movefile@y("D://testfile1.property") |
Delete testfile1.property. |
8 |
=movefile@cp("D://testfile1.property","file.property") |
Copy the file to the main directory and rename it file.property. |
Related function: