Search code examples
artifactory

How to list subfolders in Artifactory


I'm trying to write a script which cleans up old builds in my generic file repository in Artifactory. I guess the first step would be to look in the repository and check which builds are in there.

Each build shows up as a subfolder of /foo, so for example I have folders /foo/123, /foo/124, /foo/125/, etc.

There doesn't seem to be a ls or dir command. So I tried the search command:

jfrog rt search my-repo/foo/*

But this recursively lists all files, which is not what I'm looking for. I just need the list of direct subfolders. I also tried

jfrog rt search my-repo/foo/* --recursive=false

but this doesn't return any results, because the search command only returns files, not folders.

How do I list the subfolders of a given folder in an Artifactory repository?


Solution

  • The jfrog cli now includes the --include-dirs option for search.

    The command:

    jf rt search --recursive=false --include-dirs path/
    

    will essentially act like an ls.