TL;DR: to delete all Heroku apps matching the
<PATTERN>
:heroku apps | grep <PATTERN> | xargs -n1 -I {} /bin/bash -c 'heroku apps:destroy {} --confirm={}'
This article goes over how to delete multiple Heroku apps with the CLI.
Prerequisites
List Apps
List all Heroku apps:
heroku apps
List all Heroku apps in team my-team
:
heroku apps --team=my-team
List all Heroku apps matching the pattern my-app
:
heroku apps | grep my-app
List all Heroku apps matching the pattern my-app
and excluding production
:
heroku apps | grep my-app | grep -v production
Delete Apps
Delete the first Heroku app matching the pattern my-app
:
heroku apps | grep my-app | head -1 | xargs -n1 -I {} /bin/bash -c 'heroku apps:destroy {} --confirm={}'
Delete all Heroku apps matching the pattern my-app
:
heroku apps | grep my-app | xargs -n1 -I {} /bin/bash -c 'heroku apps:destroy {} --confirm={}'