# ReplaceDirectory(string, string)

> Replaces a directory.

## Definition

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

```csharp
public static void ReplaceDirectory(string src, string dst)
```

### Parameters

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

### Remarks

Replaces the directory located at **dst** with the directory located at **src**. if **dst** doesnt exists it copies the file. If **dst** exists then it deletes it and copies the directory at **src** to **dst** Additional Resources: [FileUtil.ReplaceFile](/engine/6000.3/script-reference/unityeditor/fileutil/replacefile.md).

### Examples

```csharp
using UnityEngine;
using UnityEditor;

public class ReplaceDir : MonoBehaviour
{
    [MenuItem("Example/Replace Directory")]
    static void ReplaceDirectory()
    {
        FileUtil.ReplaceDirectory("sourcepath/YourFolder", "destpath/YourNewFolder");
    }
}
```
