Search code examples
artifactoryartifactory-query-langjfrog-cli

Cleanup old artifacts from Jfrog artifactory OSS


I'm using Jfrog artifactory OSS version 5. I can see my snapshot repository is too huge and I want to remove unwanted artifacts from snapshot repository.

I want to remove all artifacts which were not downloaded during last 6 months. I tried below method, but its not working seems because of I'm using OSS version.

curl -X POST -v -u user:'password' "http://<my artifactory url>/artifactory/api/execute/cleanup?params=months=6|repos=snapshots|dryRun|paceTimeMS=2000"

Is there any other way that I can perform my task and if somebody can help me to do this, it would be really appreciated.

Thank You


Solution

  • You can use JFrog's CLI to delete items based on AQL queries.


    For example, you can use an AQL query like:

    items.find({"created" : {"$before" : "6mo"}}) 
    

    To find all items that were created over 6 month ago.

    You can then use your AQL as part of a spec file for deleting items and artifacts, using the JFrog CLI.