---
title: "Automation Workflows"
canonical: "https://documentation.chaos.com/space/DOCSGUIDE/113289523/Automation%20Workflows"
format: markdown
---
This page provides information about workflows for automating daily tasks.

> ⚠️ These methods should be used with extra care to avoid potential issues.


## **Find and Replace Text Across Space**

---


---



---



---



---



## **Add/Remove Watchers from Space**

---


---



---



---



## **Bulk Delete Trash**

---


---



---



## **Bulk Delete Pages**

---


---



## **Bulk Page Restrictions**

---


---



## **Copy Space Permissions**

---


---



## **Detect Broken Images**

---


---



---



## **Detects Unused Attachments**

---

> ℹ️ The built-in option for detecting unused attachments available in the ... menu of each page does not always work properly. So this script is very handy in detecting unused attachments across an entire space even though the built-in option does not detect them.


---


- Type the following script in the black Script Console:


```
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.pages.Attachment
import com.atlassian.confluence.pages.AbstractPage
import com.atlassian.sal.api.component.ComponentLocator
import org.jsoup.Jsoup

// Set your space key
def spaceKey = "space key"  // Change to your target space key

def spaceManager = ComponentLocator.getComponent(SpaceManager)
def pageManager = ComponentLocator.getComponent(PageManager)

def space = spaceManager.getSpace(spaceKey)
assert space : "❌ Space not found: $spaceKey"

// Get all pages in the space (recursive)
def allPages = pageManager.getPages(space, true)

def totalUnused = 0

allPages.each { AbstractPage page ->
    def attachments = page.getAttachments()
    if (!attachments) return

    def content = page.getBodyAsString()
    def doc = Jsoup.parse(content)

    def referencedNames = [] as Set<String>

    // Extract references from <ac:link> and <img> tags

    doc.select("ac|link[ac:anchor]").each { link ->
        referencedNames << link.attr("ac:anchor")
    }

    doc.select("ri|attachment").each { tag ->
        def filename = tag.attr("ri:filename")
        if (filename) referencedNames << filename
    }

    doc.select("img").each { img ->
        def src = img.attr("src")
        if (src) {
            def name = src.tokenize("/")[-1]
            referencedNames << name
        }
    }

    // Detect unused attachments
    def unused = attachments.findAll { Attachment a ->
        !referencedNames.contains(a.fileName)
    }

    if (unused) {
        totalUnused += unused.size()
        log.warn("🗂 Page: '${page.title}' (${page.urlPath}) — Unused attachments:")
        unused.each {
            log.warn("   ➤ ${it.fileName}")
        }
    }
}

if (totalUnused == 0) {
    log.warn("✅ No unused attachments found in space '${spaceKey}'.")
} else {
    log.warn("📦 Total unused attachments in space '${spaceKey}': $totalUnused")
}


```


- Replace the "**space key**" with the real space key of the space you want to check for unused attachments.
- Click **Run**.


---



## **Confluence Cloud Solutions**

---

To check for broken links, use the Broken Link Checker tool: [https://drive.google.com/file/d/1xJ594LfKr6Wml2yt9TM-_bqfQRej3f6R/view?usp=sharing](https://drive.google.com/file/d/1xJ594LfKr6Wml2yt9TM-_bqfQRej3f6R/view?usp=sharing) 

To replace repetitive words/phrases/sentences with other words/phrases/sentences, use the InfoReplacer tool: [https://drive.google.com/file/d/1GibQYV71A5uACsljKWmzYD3R9gOZWiYs/view?usp=sharing](https://drive.google.com/file/d/1GibQYV71A5uACsljKWmzYD3R9gOZWiYs/view?usp=sharing) 

To clean a zip file containing archived documentation from unused attachments and sections, use the ZipCleaner tool: [https://drive.google.com/file/d/11YDLn4Fgwf_6bl3T9fjokPoUL3BkVKHZ/view?usp=sharing](https://drive.google.com/file/d/11YDLn4Fgwf_6bl3T9fjokPoUL3BkVKHZ/view?usp=sharing) 

To resize images in a zip file containing archived documentation, use he Resizer tool: [https://drive.google.com/file/d/1EDXy-nPeuWF4ifJdO9kSxQ1LcVAIQW8S/view?usp=sharing](https://drive.google.com/file/d/1EDXy-nPeuWF4ifJdO9kSxQ1LcVAIQW8S/view?usp=sharing) 

To update the CSS of a zip file containing archived documentation, use the Style_Updater tool: [https://drive.google.com/file/d/1GeyW9Z9LnNi6L3n2GzY6iVjntyNQTM4l/view?usp=sharing](https://drive.google.com/file/d/1GeyW9Z9LnNi6L3n2GzY6iVjntyNQTM4l/view?usp=sharing) 

> ✅ The ZipCleaner, Resizer and Style_Updater have been merged into a single tool, available upon request.