---
title: "Delete files when their owner is deleted · Agent Wranglers"
url: https://agentwranglers.se/playbook/files-and-media/storage-and-backups/delete-files-with-owner
id: MED-49
level: Required
applies: eu-users
risk: law
updated: 2026-10-22
build: a2a6bdfed830
tokens: 1064
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Delete files when their owner is deleted

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Storage and backups](https://agentwranglers.se/playbook/files-and-media/storage-and-backups.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: MED-49
- Level: Required
- Chapter: [Storage and backups](https://agentwranglers.se/playbook/files-and-media/storage-and-backups.md)
- Rule: Record every stored object in a files table with its owner, and delete the objects in the same job that deletes the owner.
- Check: Create a test owner with an upload, a thumbnail and two versions of a file. Delete the owner. A listing of the owner's prefix, including old versions, is empty. The weekly sweep reports zero objects without a row.
- Risk: A law broken
- Applies when: The project has users in the EU.
- How: Make the delete job remove objects first, then rows, so a crash leaves rows to retry rather than unknown objects. On versioned buckets delete every version, or the file lives on. Include derived files, such as thumbnails and rebuilt images. Run a weekly sweep that lists the bucket and compares it with the table. Delete objects with no row that are older than 7 days. Deleting the owner, or an erasure request, skips the bin from [Keep deleted files restorable for 30 days](https://agentwranglers.se/playbook/files-and-media/storage-and-backups/deleted-files-bin.md). A single file a person deletes waits out that bin first. Backup copies age out as [Keep backups for a set time](https://agentwranglers.se/playbook/operations/disaster-recovery/backup-retention.md) sets. Write all three periods into one [retention schedule](https://agentwranglers.se/playbook/compliance/records-and-data-map/retention-schedule.md), so the deletion jobs read the same numbers. The request side and time limits are in [let people see and delete their data](https://agentwranglers.se/playbook/website/privacy/data-requests.md).

## Sources

- [GDPR Article 17 on right to erasure](https://eur-lex.europa.eu/eli/reg/2016/679/oj)

## Related rules

- DAT-72 [Delete every copy of a tenant when the contract ends](https://agentwranglers.se/playbook/data/multi-tenancy/tenant-offboarding.md) in Data and databases
- MED-4 [Keep deleted files restorable for 30 days](https://agentwranglers.se/playbook/files-and-media/storage-and-backups/deleted-files-bin.md) in Files and media
- MED-6 [Restore files and their records together](https://agentwranglers.se/playbook/files-and-media/storage-and-backups/restore-files-with-records.md) in Files and media
- MED-48 [Store the same file once per owner](https://agentwranglers.se/playbook/files-and-media/storage-and-backups/dedupe-by-hash.md) in Files and media
- OPS-46 [Keep backups for a set time](https://agentwranglers.se/playbook/operations/disaster-recovery/backup-retention.md) in Operations and observability
- CMP-11 [Keep one retention schedule](https://agentwranglers.se/playbook/compliance/records-and-data-map/retention-schedule.md) in Compliance and governance
- WEB-217 [Let people see and delete their data](https://agentwranglers.se/playbook/website/privacy/data-requests.md) in Website
- MED-21 [Purge cached copies when a file is deleted or removed](https://agentwranglers.se/playbook/files-and-media/serving-files/cdn-purge-on-delete.md) in Files and media
- MED-35 [Record who uploaded each file and under what licence](https://agentwranglers.se/playbook/files-and-media/copyright-and-takedowns/uploader-and-licence.md) in Files and media

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/files-and-media/storage-and-backups/delete-files-with-owner">Agent Wranglers files and media playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Store the same file once per owner](https://agentwranglers.se/playbook/files-and-media/storage-and-backups/dedupe-by-hash.md)
- [Storage and backups](https://agentwranglers.se/playbook/files-and-media/storage-and-backups.md)
