ajCopyFolder function
Description
The ajCopyFolder function copies file(s) from source folder to destination folder
Syntax
ajCopyFolder(source_folder_path, destination_folder_path, [overwrite], [run_condition],[run_by_function_point_only])
Argument Name | Argument Type | Description |
---|---|---|
source_folder_path (required) | String | The path of the folder that is to be copied. Both the forward-slash (/) and backslash (\) are supported as the folder separator. |
destination_folder_path (required) | String | The destination folder path where the file(s) 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) | Boolean | 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) | Boolean | The function will run when the value is TRUE. Otherwise will not run. The default value is TRUE. |
run_by_function_point_only (optional) | Boolean | If it equals FALSE, the function can be executed through ‘Excel Calculation’ (can be either Automatic or Manual, Calculate Now or Calculate Sheet) or Preview Function Point. If it equals TRUE, the function can be executed with Preview Function Point (AlchemyJ ribbon \ Preview Function Point) only. The default value is TRUE. |
The function will return:
1) Return Value: TRUE, #VALUE!
2) Return Type: Single Value
Example
Example 1
=ajCopyFolder("c:\Documents", "c:\new_folder\")
If the source folder and destination folder path exist, the function returns TRUE. The entire folder will be copied under c:\new_folder and the new folder path is c:\new_folder\Documents . If the source folder path or destination folder path does not exist, error #VALUE! would be returned.
Error Scenarios
It will return #VALUE! when missing any required parameter or mismatch parameter type. Besides, system will raise error for below scenario(s).
Error Scenario |
---|
Invalid source folder path. |
Invalid destination folder path. |
The file already exists in the destination folder path. |
No authority to operate the folder. |