Object Storage Swift - Configure automatic object deletion

Configure automatic object deletion

Last updated 27th October 2021


To easily manage your Object Storage, you may need to define the lifespan of some of your files. This allows you, for example, to keep some backups only for a specific period.

This guide shows you how to set up automatic file deletion after a specified period or on a specific date.



There are two ways to delete your objects/files

  • After a certain number of seconds
  • On a specific date

After a certain number of seconds

To do this, configure your request's X-Delete-After header

root@server:~$ swift copy --header "X-Delete-After: 3600" container test.txt

The test.txt file will be deleted in an hour.

On a specific date

First, you need to know what the deletion date is in epoch format. To help you find the value you need to insert, use a converter.

Then you can enter this date in the X-Delete-At header:

root@server:~$ swift copy --header "X-Delete-At: 1668877261000" container test.txt

The file will therefore be deleted on the 19th November 2022.

Go further

Join our community of users on https://community.ovh.com/en/.  

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.

These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community

In accordance with the 2006/112/CE Directive, modified on 01/01/2015, prices incl. VAT may vary according to the customer's country of residence
(by default, the prices displayed are inclusive of the UK VAT in force).