ajMoveFile function
Description
The ajMoveFile function moves a file from one location to another.
Syntax
ajMoveFile(source_file_path, destination_file_path, [overwrite], [run_condition],[run_by_function_point_only])
Argument Name | Description |
---|---|
source_file_path (required) | Specify the full path of the file to be moved. Both the forward-slash (/) and backslash (\) are supported as the folder separator. |
destination_file_path (required) | Specify the destination full folder path or file path where the file will be moved to. If it is a folder path, then the path needs to end with a slash. Both the forward-slash (/) and backslash (\) are supported as the folder separator. |
overwrite (optional) | TRUE - a file with the same name is overwritten. FALSE - a file with the same name is not overwritten. Error #VALUE! would be returned. The default is FALSE. |
run_condition (optional) | The function will run when the value is TRUE. Otherwise will not run. If you do not specify anything, the default value will always be TRUE. |
run_by_function_point_only (optional) | If it equals FALSE, the function can be executed through ‘Excel Calculation’ (can be either Automatic or Manual, Calculate Now or Calculate Sheet) or Run Function Point. If it equals TRUE, the function can be executed with Run Function Point (AlchemyJ toolbar \ Run Function Point) only. If you do not specify anything, the default value will always be TRUE. |
The function will return:
1) Content type: TRUE, #VALUE!
2) Method: Within a cell / cell array
Example
Example 1
=ajMoveFile("c:\source.txt", "c:\new_folder\")
If the source file path and destination folder path exist, the function returns TRUE. The file will be moved to c:\new_folder
Example 2
=ajMoveFile("c:\source.txt", "c:\new_folder\target.txt")
If the source file path and destination folder path exist, the function returns TRUE. The file will be moved to c:\new_folder and the file will be renamed to target.txt
Example 3
=ajMoveFile("c:\no_such_file.txt", "c:\new_folder\")
If the source file does not exist, error #VALUE! would be returned.