Dynamic creation of Target directories

Question: The actual path of the source file is separated by folders by \year\month\day\, however they don’t exist on the target server so they need to be created. Is there a way to tell the file target to create any directory structure it needs automatically.

Answer: Yes, we can use a custom plugin code (see below) and use it in the process flow.

Step 1 : create custom plugin with this code:

import java.io.File;

String filePath = context.get("var_filePath");
File tempPath = new File(filePath);
if(!tempPath.exists()){
tempPath.mkdirs();
}


Step 2: Now in process flow design after the Source activity, use a PutContextVar, create a variable names var_filePath and the value should be Service.SourceActivityName.filePath

Have more questions? Submit a request

0 Comments

Article is closed for comments.