---
title: "How to remove a selection of attachments"
canonical: "https://support.appfire.com/space/SUPPORT/89147307/How%20to%20remove%20a%20selection%20of%20attachments"
format: markdown
---
# Description

For [release 3.3](https://appfire.atlassian.net/wiki/spaces/ACLI/pages/60560627) and above, **getAttachmentList** and **runFromAttachmentList** actions provide a lot of flexibility to find and do actions on a set of attachments determined by various conditions. One of the primary use cases is to remove attachments. 

1. Condition on what content contains the attachments
  1. By space - all content in a space. Use the **space** parameter.
  2. By page - a specific page identified by **space** and **title** or **id** (content id).
  3. By search conditions similar to the UI search screen - see [Searching Confluence](https://confluence.atlassian.com/display/DOC/Searching+Confluence):
    1. **search** - search text
    2. **searchTypes** - what type of content to search, it this case only **page** and **blogpost** apply
    3. **space** - where to restrict seach
    4. **userId** - restrict to a content created by a specific user
2. Condition on the name of the attachments to be listed or acted on - **regex** is a [regex](http://www.regular-expressions.info/reference.html) match string on the attachment name

# Steps

1. Determine the content condition you need. If it is a search, first use **getContentList** to verify that the search conditions result in the right set of pages.
2. Determine the attachment name condition.
3. Use **getAttachmentList** to list the attachments found by your criteria to verify the right set of attachments are found.
4. Use **runFromAttachmentList** with the same parameters and specifying a **common** action of **removeAttachment** using the appropriate replacement variables.

# Example

Here is a simple example used on this site for clean-up.

##### **Verify list of attachments**

```
confluence --action getAttachmentList --space info --title downloads --regex ".*-SNAPSHOT.*"
```

##### **Run the remove**

```
confluence --action runFromAttachmentList --space info --title downloads --regex ".*-SNAPSHOT.*" --common '-a removeAttachment --id @pageId@ --name "@attachment@"'
```