# Applying tags to output files in subdirectories on S3

**URL:** <https://community.seqera.io/t/applying-tags-to-output-files-in-subdirectories-on-s3/1533>\
**Category:** Ask for help\
**Tags:** nextflow, aws\
**Created:** [December 10, 2024, 3:35pm UTC](https://community.seqera.io/t/applying-tags-to-output-files-in-subdirectories-on-s3/1533 "2024-12-10T15:35:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![willbradshaw](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/willbradshaw/32/750_2.png) [@willbradshaw](https://community.seqera.io/u/willbradshaw)\
**Post date:** [December 10, 2024, 3:35pm UTC](https://community.seqera.io/t/applying-tags-to-output-files-in-subdirectories-on-s3/1533/1 "2024-12-10T15:35:49Z")

</div>

I’m using the `tags` directive in the workflow output block to apply S3 tags to objects in my output directory (which is in an S3 bucket):

```auto
output {
    "results" {
        path "results"
        tags nextflow_file_class: "publish", "nextflow.io/temporary": "false"
    }
}

```

This works for most output files, but doesn’t seem to apply the tags to files within a subdirectory of the `results` directory, for example those generated by this process:

```auto
// Generate a BBMap index from an input file
process BBMAP_INDEX {
    label "BBTools"
    label "max"
    input:
        path(reference_fasta)
        val(outdir)
    output:
        path("${outdir}")
    shell:
        '''
        odir="!{outdir}"
        mkdir ${odir}
        cp !{reference_fasta} ${odir}/reference.fasta.gz
        cd ${odir}
        bbmap.sh ref=reference.fasta.gz t=!{task.cpus} -Xmx!{task.memory.toGiga()}g
        #tar -czf human-ref-index.tar.gz human_ref_index
        '''
}

```

Instead of being annotated as specified in the output statement above, these files seem to inherit the tags of the original files in the working directory they were copied from (in particular, `"nextflow.io/temporary": "true"`).

This is a problem, because I’m using the `nextflow.io/temporary` tag as a target for my S3 auto-cleanup routine, in order to automatically clean up Nextflow working directories after a certain number of days. This is leading to published files in subdirectories also getting deleted after that time, even though they shouldn’t be marked as temporary at all.

Is there any way to propagate the tags from the output statement to files in subdirectories (on S3)?
