Is there a quick way to do something like:
cf delete *-failed
To delete all applications ending with -failed ?
Is there a quick way to do something like:
cf delete *-failed
To delete all applications ending with -failed ?
If you're on Linux/Unix/Cygwin, you can do this:
cf apps | tail +5 | cut -d ' ' -f 1 | grep "my-filter" | xargs -n 1 cf delete -f
The first will get a list of apps, the second will strip off the headers that the cf cli writes, the third cuts out just the app names and the fourth filters and the fifth will run cf delete -f for each app it finds.
There are tons of variations on this, to filter and grab only the information you want.
Write a shell-script or Powershell script (Wrapper scripts) that execute this command
cf apps
and read the response that is given back.. You will get all the app-names . Read that list recursively and Match the pattern for app-names ending with -failed and then execute delete-command
cf delete APP_NAME