ajCopyFile function
Description
The ajCopyFile function copies a file from one location to another.
Syntax
ajCopyFile(source_file_path, destination_folder_path, [overwrite], [run_condition],[run_by_function_point_only])
Argument Name | Description |
---|---|
source_file_path (required) | Specify the full path of the file that is to be copied. Both the forward-slash (/) and backslash (\) are supported as the folder separator. |
destination_folder_path (required) | Specify the destination full folder path where the file will be copied to. It is optional 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
=ajCopyFile("c:\source.txt", "c:\new_folder\")
If the source file and destination folder path exist, the function returns TRUE. The file will be copied to c:\new_folder
Example 2
=ajCopyFile("c:\no_such_file.txt", "c:\new_folder\")
If the source file does not exist, error #VALUE! would be returned.