Search code examples
artifactoryjfrog-cli

Artifactory CLI sort and limit the number of artifacts


Is there any way to sort and limit the number of artifacts while downloading artifacts using CLI for Jfrog Artifactory?

Example: if we have 100 artifacts in a single repo and I want to download only top 5 artifacts.

Thanks!


Solution

  • Jfrog CLI currently does not support SORT and LIMIT. This is actually a roadmap item currently evaluated for Q4 17.

    You can follow this Github issue to stay up-to-date with the implementation efforts.

    for the meantime, you can use AQL with SORT and LIMIT over the JFrog REST API.

    For example, the below AQL query Sorts by Descending creation dates and Limits the returned number of items to 5. it can be used as the body of a simple POST method:

    items.find(
    {
                "repo":"my-repo-local"
        }
    ).sort({"$desc" : ["created"]}).limit(5)
    

    HTH,

    Or