# Runtime Save Deletion

Deleting saved data can be a dangerous task, as it results in the player losing their progress. Make sure saves are being deleted only when necessary (usually only when the player manually deletes them).

## Deleting a File

Use the method below to completely remove a save file from the user's system.

```csharp
saveFile.DeleteFile();
```

## Deleting All Save Files

{% hint style="success" %}
Deleting all saves is easier in [ESave Pro](https://u3d.as/3vCT).
{% endhint %}

Deleting all save files will require you to have a reference to all of them. Using the save storage is one way of getting save files, but only the ones with `addToStorage` set to true will be available in the save storage.

```csharp
// Convert to list
var saveFiles = SaveStorage.instance.saves.Values.ToList();

// Loop through all saves and delete them
foreach (var saveFile in saveFiles)
{
    saveFile.DeleteFile();
} 
```

## Empty File

Alternatively, you have the option of completely removing all data while keeping the file in the user's system.

```csharp
saveFile.EmptyFile();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://espergames.gitbook.io/esave/scripting/runtime-save-deletion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
