Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete all Digital Ocean droplets - good for testing
function droplet_delete_all
echo "Getting list of droplets"
set --local droplets (doctl compute droplet list | tail --lines=+2 | awk '{print $2}')
if test -n "$droplets"
echo "Deleting droplets: $droplets"
for droplet in $droplets
doctl compute droplet delete $droplet
echo "Deleted droplet: $droplet"
end
else
echo "No droplets to delete"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment