<p>There's a plugin that you can use to find unused assets: <a href="https://github.com/born05/craft-assetusage/tree/craft-2" rel="nofollow noreferrer">Asset Usage</a></p>
<p>This gives you an extra column in the Assets listing to indicate if an asset is used or not. Unfortunately, the Craft 2 version doesn't have the console command to delete all unused assets that the Craft 3 version does, but this may help you anyway.</p>

CC BY-SA 4.0
2021-01-27T11:09:12.450Z
2021-01-27T11:09:12.450Z
Martin Spain
<p>I am very new to Craft and how it works. I've got a client with a Craft site (v2.9.2), that I help them with. It was created by another developer.</p>
<p>I want to help them tidy up their Assets.</p>
<p>There are two folders (on S3) for their Assets. <code>/Media</code> and <code>/Media/Files</code>.</p>
<p>Scanning by eye, I can see <code>/Media/Files</code> <em>appears</em> to be a subset of what's in <code>Media</code> (meaning, they are duplicate files). Before we potentially delete the <code>/Media/Files</code> folder, I'd like to programatically confirm if any of them are being used. My suspicion is only files in <code>/Media/</code> are used on the site.</p>
<p>Is there any easy way to see which assets are in use, and where they are used?</p>
<p>I found questions on StackExchange re how to see what media is <em>not</em> in use, such as <a href="https://craftcms.stackexchange.com/questions/22506/how-to-find-out-which-assets-are-being-used">this one</a>. I also found <a href="https://craftcms.stackexchange.com/questions/2006/how-do-i-display-a-list-of-assets-with-the-entries-they-are-related-to">a question</a> on how to do something similar to what I need.</p>
<p>Although, to be honest, I had no idea where I'd utilise such code. I'm not going to get into creating a new plug-in.</p>
<p>For example, <a href="https://craftcms.stackexchange.com/a/2010/10913">this</a> was shared in the answer to that question:</p>
<pre><code>{% set content = craft.entries.section('content').find() %}
{% set usedFotos = craft.assets.relatedTo(content).order('filename').find() %}

{# Loop throught the array of assets #}
{% for usedFoto in usedFotos %}

    &lt;h2&gt;{{ usedFoto.filename }}&lt;/h2&gt;
    &lt;ul&gt;

        {# Loop throught entries related to this asset #}
        {% for entry in craft.entries.relatedTo(usedFoto).order('title') %}
            &lt;li&gt;{{ entry.title }}&lt;/li&gt;
        {% endfor %}

    &lt;/ul&gt;

{% endfor %}
</code></pre>
<p>Where would I utilise this code?</p>

<assets><craft2>
Display list of assets that are in use?
# Display list of assets that are in use?

(Asked by: username_0 on 2021-01-27)

I am very new to Craft and how it works. I've got a client with a Craft site (v2.9.2), that I help them with. It was created by another developer.
I want to help them tidy up their Assets.
There are two folders (on S3) for their Assets. /Media and /Media/Files.
Scanning by eye, I can see /Media/Files appears to be a subset of what's in Media (meaning, they are duplicate files). Before we potentially delete the /Media/Files folder, I'd like to programatically confirm if any of them are being used. My suspicion is only files in /Media/ are used on the site.
Is there any easy way to see which assets are in use, and where they are used?
I found questions on StackExchange re how to see what media is not in use, such as this one. I also found a question on how to do something similar to what I need.
Although, to be honest, I had no idea where I'd utilise such code. I'm not going to get into creating a new plug-in.
For example, this was shared in the answer to that question:
{% set content = craft.entries.section('content').find() %}
{% set usedFotos = craft.assets.relatedTo(content).order('filename').find() %}

{# Loop throught the array of assets #}
{% for usedFoto in usedFotos %}

    {{ usedFoto.filename }}
    

        {# Loop throught entries related to this asset #}
        {% for entry in craft.entries.relatedTo(usedFoto).order('title') %}
            {{ entry.title }}
        {% endfor %}

    

{% endfor %}

Where would I utilise this code?

**Tags:** assets, craft2

---

## 1 answers

### Answer by username_1 on 2021-01-27. Score: 1

There's a plugin that you can use to find unused assets: [Asset Usage](https://github.com/born05/craft-assetusage/tree/craft-2)

This gives you an extra column in the Assets listing to indicate if an asset is used or not. Unfortunately, the Craft 2 version doesn't have the console command to delete all unused assets that the Craft 3 version does, but this may help you anyway.


---

