# DeleteFileOrDirectory(string)

> Deletes a file or a directory given a path.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public static bool DeleteFileOrDirectory(string path)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

This function's path is relative to the project root folder but it can also accept absolute paths.

All file separators should be forward ones "/" (Unix style).

### Examples

```csharp
using UnityEngine;
using UnityEditor;

public class DeleteFile : MonoBehaviour
{
    [MenuItem("Example/Delete Something")]
    static void DeleteSomething()
    {
        FileUtil.DeleteFileOrDirectory("yourPath/YourFileOrFolder");
    }
}
```
