# ExpressionTools loadContents how to load from array

**URL:** <https://cwl.discourse.group/t/expressiontools-loadcontents-how-to-load-from-array/947>\
**Category:** CWL Questions\
**Created:** [August 29, 2024, 12:30pm UTC](https://cwl.discourse.group/t/expressiontools-loadcontents-how-to-load-from-array/947 "2024-08-29T12:30:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CloXD](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/cloxd/32/571_2.png) [@CloXD](https://cwl.discourse.group/u/CloXD)\
**Post date:** [August 29, 2024, 12:30pm UTC](https://cwl.discourse.group/t/expressiontools-loadcontents-how-to-load-from-array/947/1 "2024-08-29T12:30:56Z")

</div>

Hello!  
I’m trying to concatenate the content of some small files using the ExpressionTool, but it seems that the loadContents doesn’t work on arrays, despite in [the doc](https://www.commonwl.org/v1.0/CommandLineTool.html#CommandLineBinding) it includes arrays of files.

Here’s a small example to reproduce the error:

```auto
cwlVersion: v1.2

class: ExpressionTool
requirements:
  InlineJavascriptRequirement: {}
inputs:
  input_files: 
    type: File[]
    loadContents: true
  single_file:
    type: File
    loadContents: true
outputs:
  output_file:
    type: File
expression: |
 ${
   var out = { output_file : { class : "File", basename : "test.txt" , contents : "" } }
   for (var i = 0; i < inputs.input_files.length; i++) {
       if ( inputs.input_files[i] ){
         if ( inputs.input_files[i].contents.match(out.output_file.contents) ){
             continue
         }
         out.output_file.contents += inputs.input_files[i].contents + "\n"
       }
   }
   return out 
 }

```

test.yaml:

```auto
input_files:
  - class: File
    location: test1.txt 
  - class: File
    location: test2.txt 
single_file:
  class: File
  location: test3.txt
  

```
