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

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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