Move files and folders to a given directory

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?


expression: |
    var array = []
    if (inputs.files != null) {
      array = array.concat(inputs.files)
    if (inputs.folders != null) {
      array = array.concat(inputs.folders)
    var r = {
         { "class": "Directory",
           "basename": inputs.destination,
           "listing": array
     return r; 

Hello! Could you clarify please:

  1. If you have an input directory that is nested, does the move not occur?
  2. Is it that you have as input a list that can consist of both files as well as folders, and this can not be moved to a output directory?