How to delete multiple versioned package using curl?

I am trying to delete Nexus package which are associated with more than one version. I am running a curl command to delete it, but I want a generic command which will delete all package under a folder

This is the curl command I am using
curl -v -u ${NEXUS_CREDS} -X “DELETE” http://${SONATYPE_NEXUS_SERVICE_SERVICE_HOST}:${SONATYPE_NEXUS_SERVICE_SERVICE_PORT}/repository/${NEXUS_REPO_NAME}/${APP_NAME}/${PACKAGE}

where PACKAGE ="${APP_NAME}-${VERSION}.tar.gz". I need to provide a command which will not delete a particular version only.

There isn’t an official API that can do that as far as I know. You can use the UI to delete a folder of items from the browse tree. You could also figure out how to call that API, but it’s an internal one so that won’t be supported and could change at any time.

You may be able to use the search APIs to find versions then use those to execute many delete requests.