Search code examples
mavenartifactory

How do I map the largest files\folders in Artifactory


It's often hard to map the most storage heavy parts in my mvn repo.

I suspect that most of my space is occupied by unnecessary artifacts or snapshots.

How can I retrieve a sorted list (from large to small) of all the folders in Artifactory (Maven repo)?

I've looked at Jfrog api and cli guides but was unable to find straightforward answer.


Solution

  • You can use Artifactory's AQL to get what you're after. for example, get all Items in a repository, that where created over 30 days ago, sorted by descending Size (disk space):

        items.find(
    {
                "repo":"my-local-repo",
                "$or":[
                    {
                        "$and":[
                         {
                            "created":{"$before":"30d"}
                         }
                                ]
                    }
                    ]
        }
    ).sort({"$desc" : ["size"]})
    

    You can use Artifactory's REST api to send your AQL query. You can read more about AQL here, an "tune" your query to find what you are after.

    note: though you can use AQL with the CLI, sorting is currently not supported in CLI's AQL queries so use the REST API instead.

    HTH, Or