ajMoveFolder function
Available since AlchemyJ v4.1.3
Description
The ajMoveFolder function moves a folder from one location to another.
Syntax
ajMoveFolder(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 to be moved. Both the forward-slash (/) and backslash (\) are supported as the folder separator. |
destination_folder_path (required) | String | The destination folder path where the folder will be moved to. It will create the parent folder automatically if the parent folder does not exist. The path needs to end with a slash. Both the forward-slash (/) and backslash (\) are supported as the folder separator. |
overwrite (optional) | Boolean | Defines whether the file at the destination folder path should be overridden if it already exists. TRUE - Override the file at the destination folder path with the file at the source folder path. FALSE - Return a #VALUE! error. 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
=ajMoveFolder("c:\folder1", "c:\folder2")
If the source folder path and destination folder path exist, the function returns TRUE. The folder1 will be moved to c:\folder2. If folder2 does not exist, it will create folder 2 first and then move folder1 to under folder2 and returns TRUE as well.
If the source folder cannot be found, the function will return #VALUE!.
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. |
Cannot overwrite the destination file. |
No authority to operate the folder. |