My aim is to create a bash loop over my fastq files that are in a directory like so:
https://ibb.co/cMvx7a
whereby, paired read files are organised in the form:

1 

1

2

2

3

3

etc..

I don't know a way of dealing with these paired files within the cutadapt loop
Something along these lines is what I'm looking for:

    for file in folder

    do
        cutadapt -a ADAPTER_FWD -A ADAPTER_REV -o out.1.fastq -p out.2.fastq reads.1.fastq reads.2.fastq
    done

but I want to do pairs together from the folder and I don't know how. 

Thanks in advance. 


This is not a bioinformatics question, it is more a shell scripting question.

This draft should help you to get started:

    for i in *_R1.fastq.gz
    do
      SAMPLE=$(echo ${i} | sed "s/_R1\.fastq\.gz//")
      echo ${SAMPLE}_R1.fastq.gz ${SAMPLE}_R2.fastq.gz
    done

