I am using an ExpressionTool to move files into a destination folder and this works perfectly.
However I was planning to extent this to also include directories such that files and directories can be given to a step which then moves it to a specified directory.
When only using the inputs.files it works as expected but when switching to a folder or an array containing both types the object becomes un-iterable. Any idea how to combine the move of files and folders?
SOLUTION:
expression: |
${
var array = []
if (inputs.files != null) {
array = array.concat(inputs.files)
}
if (inputs.folders != null) {
array = array.concat(inputs.folders)
}
var r = {
'results':
{ "class": "Directory",
"basename": inputs.destination,
"listing": array
}
};
return r;
}