user1316502
user1316502

Reputation: 879

What should be in "pattern": of Artifactory downloadSpec file to search both folder and subfolder

What should be in "pattern": of Artifactory downloadSpec file to include or skip sub folder

repo / folderA / folderB / *.xml

repo / folderA / *.xml

So I need to download xmls from folderA or from specific subfolder of folderA Normally I would write :: "pattern": "repo/folderA/**/*.xml" but this pattern cant find artifacts under folderA

Upvotes: 1

Views: 1994

Answers (1)

Dima Nevelev
Dima Nevelev

Reputation: 408

In case you have a small amount of folders under folderA, you can use the "excludePatterns" feature. For example:

{
"files": [
    {
        "pattern": "repo/folderA/*.xml",
        "excludePatterns": ["folderA/folderC/*","folderA/folderd/*"]
    }
  ]
}

You can read more about exclude patterns on JFrog CLI File Specs documentation or JFrog CI servers File Specs documentation (use the one that relevant for you).
If you have too many folders under folderA or the folders name will be changed in future, use two fileSpacs for download:

{
"files": [
    {
        "pattern": "repo/folderA/*.xml",
        "recursive": false
    },
    {
        "pattern": "repo/folderA/folderB/*.xml",
        "recursive": false
    }
  ]
}

Upvotes: 7

Related Questions