Question

How to filter list command to get droplets older than X days?

I need to delete droplets that are older than 1day. When I do doctl compute droplet list It does not show my any info about age. How can I list and delete droplets that are older than 1 day?


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
August 4, 2022

Hi there,

I don’t think that the created_at field is available via the doctl compute droplet list command. What you could do is open a feature request here to get that added as an option:

https://github.com/digitalocean/doctl/issues

In the meantime, I could suggest using the HTTP API which includes the created_at date:

https://docs.digitalocean.com/reference/api/api-reference/#operation/droplets_list

Hope that this helps!

Best,

Bobby