---
title: "Delete attachment(s) with a specific word in the file name"
canonical: "https://support.appfire.com/space/JMWEC/465504378/Delete%20attachment(s)%20with%20a%20specific%20word%20in%20the%20file%20name"
format: markdown
---
> Macro (aura-html)

This article provides the code snippet to delete attachment(s) that have a specific word in the file name using [https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=jmwec&title=Build-your-own%20%28scripted%29%20Post-function&linkCreation=true&fromPageId=465504378](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=jmwec&title=Build-your-own%20%28scripted%29%20Post-function&linkCreation=true&fromPageId=465504378) 

## \uD83D\uDCD8 Instructions

1. Navigate to the intended workflow to make the necessary changes in the edit mode.
2. Select the required transition.
3. Select the *Post functions *tab and click `Add post function`.
4. Add the [https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=jmwec&title=Build-your-own%20%28scripted%29%20Post-function&linkCreation=true&fromPageId=465504378](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=jmwec&title=Build-your-own%20%28scripted%29%20Post-function&linkCreation=true&fromPageId=465504378)
5. Add the below Nunjucks script:

The above template deletes the attachment(s) that contain the word `test` in the filename (modify `test` in line #2 with your desired text)

![JMWE for Jira Cloud attachment deletion configuration with filename filtering](media://3308e2de-8a3e-4fae-8657-aeef65ce9126)

> ℹ️ If this post-function is added on the create transition, select the checkbox *“Delay the execution of this post-function”* under *“Delayed execution” *and select a delay of 3 seconds.


### References

- [callJira filter](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465243039)
- [Using Nunjucks Templates](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465503811)
- [Accessing JIRA Standard fields](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/466225701)
- [Tags and Expressions](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/466322168)

## \uD83D\uDCCB Related articles



> Macro (contentbylabel)