Home > Blockchain >  How to delete an artifactory directory named ${env.DateString} in curl command
How to delete an artifactory directory named ${env.DateString} in curl command

Time:03-31

I am trying to delete an artifactory directory named ${env.DateString} But unable to interpolate properly. I escaped by using \ ${env.DateString} but somehow the brackets {} are being left out. Directory path http://localhost:8080/artifactory/myrepo/Docker/${env.DateString}/

curl -H "X-JFrog-Art-Api:<API-KEY>" -X DELETE http://localhost:8080/artifactory/myrepo/Docker/\${env.DateString}/

Error:

{
  "errors" : [ {
    "status" : 404,
    "message" : "Could not locate artifact 'myrepo:Docker/$env.DateString' (Nothing to delete)."
  } ]
}[

Somehow the brackets in ${env.DateString} is missed when interpolating

CodePudding user response:

the $ and. needs to be URL encoded. We can use the below API to delete the folder curl -H "X-JFrog-Art-Api: -X DELETE http://localhost:8080/artifactory/myrepo/Docker/${env.DateString}/

  • Related